htaccess, mod_Rewrite, cakephp

痴心易碎 提交于 2019-12-08 04:18:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!