I have a block of rewrite rules. How do I make it so that these rewrite rules go into effect only if the actual html files don't exist. I tried putting... RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d Code (markup): ...at the top of the .htaccess file but it doesn't seem to be working. Even if the .html file requested exists it uses one of the redirect rules. I have narrowed the problem down to one or both of these rewrite rules for support for custom pages. RewriteRule ^(.+).(htm|html)/?$ /page.php?id=$1 [NC] RewriteRule ^(.+).(htm|html)/?$ /page.php?id=$1 [NC] Code (markup): How can I fix this? Thanks for any help in advance!
Your RewriteCond statements are only affecting the first rule after them (this can be worked around with skipping but doesn't seem to be needed in your case). Also, you shouldn't be using OR, as every request is either "not a file" OR "not a directory", sorry if that is hard to understand. Also, both your RewriteRule's are the same. Here is the new code, not the omission or OR which ends up being an AND, i.e. if request is "not a file" AND "not a directory" RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+).html?/?$ page.php?id=$1 [NC,L]