I'm looking for a way to exclude actual directories from mod_rewrite. For example, at present my URL's look like this: http://www.domain.com/category-name/ This it being rewritten to pass the category-name on to a PHP script. However, if the user tries to go to a folder inside the main area, it's not allowed because right now everything is being considered 'rewritten' by the server if it's not just a file. Here is what my .htaccess looks like right now. RewriteEngine On RewriteBase / RewriteRule ^([a-zA-Z0-9\-]+)/?$ sites.php?cat=$1 Thoughts please?
RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-zA-Z0-9\-]+)/?$ sites.php?cat=$1 Code (markup): The above only allows the rewrite rule to run if you are not referencing a file for folder that actually exists.