Reputation: 7589
i'm having the following modrewrite structure:
/links/
/links/web/
/links/travel/
..
the corresponding .htaccess would be:
RewriteRule ^links/ links.php [L]
RewriteRule ^links/web/ links.php?catID=1 [L]
RewriteRule ^links/travel/ links.php?catID=2 [L]
the problem is that the root link (first line) will always trigger before the actual category-links. is there a way to fix this? the only way i found was modifying the root link to:
^links/index.html
but i'd like to omit the index.html - any ideas how this is possible?
Upvotes: 0
Views: 63
Reputation: 82734
Add a $
:
RewriteRule ^links/$ links.php [L]
It signifies the end of the URL.
Alternatively you can do the check inside PHP, if you evaluate $_SERVER["REQUEST_URI"]
.
Upvotes: 5
Reputation: 7604
Adding the following RewriteRule first might do it (I haven't tested):
RewriteRule ^links/$ links/index.html [L]
Upvotes: 1
Reputation: 771
Put the first line last; that way, it will be executed after the others.
Upvotes: 1
Reputation: 47619
just reverse it. If no /web/ check for /links/ again
RewriteRule ^links/travel/ links.php?catID=2 [L]
RewriteRule ^links/web/ links.php?catID=1 [L]
RewriteRule ^links/ links.php [L]
Upvotes: 1