使用域名导航到Zend应用程序时出错500错误

时间:2013-04-10 16:34:39

标签: .htaccess zend-framework dns

我有一个Zead应用程序托管在godaddy上,域名指向持有应用程序的子文件夹,导致使用域名时出现500服务器错误。我使用的是Linux主机,公共文件夹的路径是/ Subfolder Name / public,这是指向域名的位置。令人困惑的是,当我导航到网站时: 主机IP地址/子文件夹路径没有问题。使用域名进行导航时,会在错误日志中生成以下内容:

Request exceeded the limit of 10 internal redirects due to probable configuration error.

环顾四周之后,这似乎是一个.htaccess问题。我的公用文件夹中的.htaccess文件位于:

    RewriteEngine On
    # The following rule tells Apache that if the requested filename
    # exists, simply serve it.
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    # The following rewrites all other queries to index.php. The 
    # condition ensures that if you are using Apache aliases to do
    # mass virtual hosting, the base path will be prepended to 
    # allow proper resolution of the index.php file; it will work
    # in non-aliased environments as well, providing a safe, one-size 
    # fits all solution.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::$
    RewriteRule ^(.*)$ - [E=BASE:%1]
    RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

1 个答案:

答案 0 :(得分:1)

第一条规则是应该阻止内部重定向,因此可能是路由到index.php的最后一次重写错误的情况。尝试更改它以简化路由:

RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

为:

RewriteRule ^(.*)$ /index.php [L]

如果index.php位于其他路径中,则只需更改/index.php,使其指向正确的位置。