问题
I've been stuck for a few hours over this. I found lots of information online but nothing that solved my issue.
I'm hosted on Dreamhost with a custom PHP installation (5.2.14). The site returns a 500 Internal Server Error with this .htaccess file.
It looks like the rewrite rule is also applied to my php.cgi file but I don't know how to avoid that.
My log file shows that there is an infinite loop somewhere "Request exceeded the limit of 10 internal redirects due to probable configuration error".
<IfModule mod_actions.c>
Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
</IfModule>
<FilesMatch "^php5?\.(ini|cgi)$">
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
</FilesMatch>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
app/.htaccess :
RewriteEngine On
RewriteBase /
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
And app/webroot/.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Any help would be appreciated! Thanks.
回答1:
I suppose it could be your cgi. Try something like this?
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
You'll also want to make sure there isn't something goofy going on in your app/webroot/.htaccess It might be helpful to post both here.
来源:https://stackoverflow.com/questions/4094090/htaccess-mod-rewrite-cakephp