Vote #66306
未完了.htaccess redirect rules not working when multiple CGI/FastCGI modules enabled
0%
説明
I just noticed something strange, using the default .htaccess file, when both mod_cgi and mod_fcgid were enabled. These are the default rewrite rules:
RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
With both mod_cgi and mod_fcgid, this translates to:
RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
This means: non-static files are served through dispatch.fcgi (as expected), but when the RewriteCond doesn't match (i.e. it's a request for an existing static file) the request is sent through to the 2nd RewriteRule -- which ends you up with lots of CGI processes all not able to serve your images/CSS.
A better solution would be to use something like this, to make sure that only one RewriteRule can be active:
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
journals
--------------------------------------------------------------------------------