带有.htaccess的无限重定向循环

时间:2012-10-10 19:58:13

标签: php .htaccess zend-framework

我正在使用Zend Framework(不是完整版,只是一些组件),但我遇到了一些问题。我没有开发出我支持的软件。当我尝试安装时,第一页会重定向,直到它破坏我的服务器:http://localhost/software/manager/index/index/index/index/index/index/index/index/index/index/index/index/index/index/index/index/index/index/index/index ...

好吧,我查看了所有代码,无法弄清楚出了什么问题。这是我的代码:

的.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ bootstrapClass.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]

php_flag magic_quotes_gpc off
php_flag register_globals off
php_value session.auto_start 0
Options -Indexes

http://pastebin.com/DTHrWJYn

1 个答案:

答案 0 :(得分:2)

问题出在

RewriteRule ^(.*)$ public/$1 [L]

Url Rewriting以这种方式工作。在重写网址后,再次应用规则。

要避免这种情况,请使用RewriteCond,例如文件是否不存在:

RewriteCond %{REQUEST_FILENAME} !-f