html - Use history.pushState while ignoring/bypassing .htaccess (alternative solution welcome) -
what i'm trying have single dynamic file takes parameter affect content (/view.html?k=about) uses history.pushstate change url more user-friendly (ki/about). in addition, anytime ajax call made on content.html load new content, updates url according, (e.g. if products loaded via ajax, change url keywords/products).
my current solution path requested ki redirected via .htaccess view.html page. view.html uses history.pushstate change url. links clicked, url updates. problem this, however, causes infinite loop.
here .htaccess file, residing in /ki/ folder.
rewriteengine on rewriterule ^(.*)$ /concept/view.html?k=$1 [r=permanent,l]
what can desired result? if there's way achieve same thing without .htaccess file that's acceptable too.
you going want rewrite url goes in form of ki/about /view.html?k=about behind scenes.
history.pushstate meant used web applictions spotify don't reload page still make sense have button have functionality. way, urls can shared without giving 404 pages.
i have not tested sure want this
rewriterule ^ki/([a-za-z]+)/$ /view.html?ki=$1
if user types in ugly url, still same page no problem. pretty urls direct users right webpage.
for more info can go here. http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
Comments
Post a Comment