htaccess、mod_Rewrite、cakephp

发布于 2024-09-30 22:17:19 字数 1103 浏览 1 评论 0原文

我已经被这个问题困住了几个小时。我在网上找到了很多信息,但没有解决我的问题。

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别忘他 2024-10-07 22:17:19

我想它可能是你的cgi。尝试这样的事情吗?

RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
RewriteRule    ^$ app/webroot/    [L]   
RewriteRule    (.*) app/webroot/$1 [L]

您还需要确保您的 app/webroot/.htaccess 中没有发生任何愚蠢的事情,将两者都发布在这里可能会有所帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文