Reputation: 11
I have this
RewriteRule ^articles/([0-9]+)-(.*)\.html$ article.php?id=$1 [L]
RewriteRule .* index.php
I still don't understand how to apply RewriteCond, due to [L] issues in .htaccess. Help!and thanks in advance :)
Upvotes: 1
Views: 564
Reputation: 655129
I guess you’re looking for something like this:
RewriteRule ^articles/([0-9]+)-(.*)\.html$ article.php?id=$1 [L]
RewriteCond $0 !=article.php
RewriteRule .* index.php
Another solution would be to exclude article.php
with the pattern of the second RewriteRule
:
RewriteRule !^article\.php$ index.php
But note that this will rewrite any other request (including other existing files). To conquer that you could use a different condition for the second rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
Upvotes: 0
Reputation: 145472
There is an excellent reference question on serverfault, which explains how rules and conditions interact:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?
Link as advised by current discussion on Meta.
Upvotes: 1