I want to have an exception for…
http ://localhost/
…while rewriting the index of any directories underneath…
http ://localhost/directory1/
http ://localhost/directory2/
By having an empty item below (the first item which is between the characters (| on the third line) it creates an exception for ALL indexes so how can I make the exception NOT apply to the localhost/ itself using this copy of .htaccess?
http ://localhost/.htaccess
RewriteEngine on
RewriteRule ^(|directory2/|directory2/) - [L]
RewriteRule !\.(css|xhtml|xml|zip)$ rewrite.php
…and I can not mess with server configuration. Additionally this question is not redirect related.
This rule makes an exception for the root index. Since nothing is between ^ (^ = starts with) and $ ($ = ends with) the requested URI this matches http:// localhost/ exactly. Having [space] index.php (or change the extension to what you want) forces the file to rewrite to itself. It does not appear to loop.