Reputation: 2512
This is my first time re-writing urls to be SEO friendly.
Here's my htaccess rule:
RewriteEngine On
RewriteRule ratings/ ratings.php
RewriteRule regions/ regionlist.php
RewriteRule mobile/ mobile.php
For some reason, when I click the same link twice, the url will append itself in the address bar. Heres a gif image showing this happening:
Is this bad? If it is, does anyone know what's wrong ?
Help would be greatly appreciated!
Thanks everyone
Upvotes: 3
Views: 245
Reputation: 846
Change your RewriteRules to this:
RewriteRule ^([a-zA-Z]+)$ $1.php
and make sure that your links to be like this:
<a href="/ratings">ratings</a>
but if you need specific rewrites change the location of slash
RewriteRule /ratings ratings.php
RewriteRule /regions regionlist.php
RewriteRule /mobile mobile.php
Upvotes: 3
Reputation: 1122
I think it's not the htaccess which couses trouble here... IMO you take current URL and append clicked item's name. Create the URL from scratch instead.
Upvotes: 1
Reputation: 304
if you want the rewrite to always be based off the root directory you may want to write your rules with a preceeding "/"(slash)
RewriteEngine On
RewriteRule /ratings ratings.php
RewriteRule /regions regionlist.php
RewriteRule /mobile mobile.php
This should force the rewrite rule to append this to the root url.
Upvotes: 0