htaccess、mod_Rewrite、cakephp
我已经被这个问题困住了几个小时。我在网上找到了很多信息,但没有解决我的问题。
我在 Dreamhost 上托管,并安装了自定义 PHP (5.2.14)。 该站点针对此 .htaccess 文件返回 500 内部服务器错误。
看起来重写规则也适用于我的 php.cgi 文件,但我不知道如何避免这种情况。
我的日志文件显示某处存在无限循环“由于可能的配置错误,请求超出了 10 个内部重定向的限制”。
<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]
和 app/webroot/.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
任何帮助将不胜感激! 谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想它可能是你的cgi。尝试这样的事情吗?
您还需要确保您的 app/webroot/.htaccess 中没有发生任何愚蠢的事情,将两者都发布在这里可能会有所帮助。
I suppose it could be your cgi. Try something like this?
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.