.htaccess - htaccess rewriting address bar -
have been trying change urls make them more seo friendly , @ moment have managed them sort of working how want it.
my original url this: http://www.example.com/index.php?keyword=nikon
so managed rewriting looks this:
http://www.example.com/compare/nikon.html
using this:
rewriteengine on rewriterule ^compare/([^/]*)\.html$ /index.php?keyword=$1 [r,nc,l]
but have tried end result url in address bar this: http://www.example.com/compare/nikon.html
if change rewritten url in address bar variables still passed , in instances there anchor # tag after url still work?
thanks help
you want rid of r
flag in rule. that's causing address bar changed original ugly looking url.
additionally, if want redirect browser ugly nicer looking url, need different rule. like:
rewriteengine on rewritecond %{the_request} \ /+index\.php\?keyword=([^&\ ]+) rewriterule ^ /compare/%1.html? [l,r] rewriterule ^compare/([^/]*)\.html$ /index.php?keyword=$1 [nc,l]
Comments
Post a Comment