This post outlines how to use RewriteCond to serve images,js,and css files correctly. However, here is my .htaccess file (placed in a directory under the server root which is always included in the site's http links) (note that my question may be related to this other post but is acutally more specific):
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2&menu2=$3 [QSA,NC,L]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2 [QSA,NC,L]
RewriteRule ^([^/]+)/?$ index.php?lang=$1 [QSA,NC,L]
The result is that the PHP page index.php is always served fine (with its rewrites working). Now, I thought that the lines:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
mean that, if we are serving a file or directory other than a PHP file then don't process the RewriteRule's. Am I wrong? Why are those two lines not working?
I've tried prepending the following line:
RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|ico|css|js)$ [QSA,NC,L]
but it's not working (when I try to retrieve the root document I get an HTTP 500 internal server error).
index.phpAt least that what your .htaccess code shows. What's the problem?