mod_rewrite weirdness
Posted: Wed Feb 13, 2008 7:05 pm
Sorry for the abstract title. I cannot think of a better way to title this question.
Can anyone tell me why the first ruleset here does not work but the second one does?
In the first rule set, a call to a directory like http://mylocalhost/Dirthatexists/ tries to push this request through the index.php bootstrap file instead of serving the index.html file that is in the directory. The second rule set works exactly as expected, serving up index.html from the Dirthatexists/ directory.
Wouldn't you think the first ruleset should work?
PS I do have the rewrite engine on, in case that comes up.
Can anyone tell me why the first ruleset here does not work but the second one does?
Code: Select all
##
# THIS RULESET FAILS
##
# If the requested filename is not an existing file
RewriteCond %{REQUEST_FILENAME} !-f [OR]
# If the requested is not an existing directory
RewriteCond %{REQUEST_FILENAME} !-d
# Pump the entire request through the bootstrap file
RewriteRule ^(.*)$ index.php [QSA,L]Code: Select all
##
# THIS RULESET WORKS
##
# If the requested filename is an existing file
RewriteCond %{REQUEST_FILENAME} -f [OR]
# If the requested filename is a directory
RewriteCond %{REQUEST_FILENAME} -d
# Use the request as is and skip the following 1 rewrite rules
RewriteRule ^.*$ - [S=1]
# Pump the entire request through the bootstrap file
RewriteRule ^(.*)$ index.php [QSA,L]Wouldn't you think the first ruleset should work?
PS I do have the rewrite engine on, in case that comes up.