Forum Moderators: phranque
I am using the rewrite rules from the Zend Reference Guide:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I thought the first RewriteCond was supposed to check if a file exists but it seems to be ignoring the file extension.
Has anyone else experienced this problem or have any ideas how to fix it? Please don't say rename the file or directory. I really can't do that. I also need this to work for all file extensions, not just pdf.
Thanks.
Options -MultiViews
AcceptPathInfo off
This prevents the *very* wasteful invocation of *six* calls to your operating system to go check the disk for each and every page, object, or file requested from your server. You may see a very-noticeable speed-up from this simple change:
RewriteEngine on
#
# Skip rewrite to /index.php if request is for /index.php itself or if requested
# URL resolves to an existing non-zero-size file, symbolic link, or directory.
[i]RewriteCond $1 ^index\.php$ [OR][/i]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ - [S=1]
# Else rewrite all requests to /index.php
RewriteRule ^.*$ index.php [L]
See explanation and discussion of almost-identical problem with WP and Joomla code here [webmasterworld.com].
Jim