我有这个 Apache 虚拟主机定义:
<VirtualHost *:80>
ServerName server1.qa.com
ServerAlias server2.qa.com
ServerAlias server3.qa.com
DirectoryIndex app_dev.php
DocumentRoot /var/www/html/web
<Directory /var/www/html/web>
# enable the .htaccess rewrites
AllowOverride All
Order allow,deny
Allow from All
</Directory>
ErrorLog /var/log/httpd/error.log
LogFormat "%h %l %t \"%r\" \"%{X-PDONE-SESSION-ID}i\" %>s %b" common
CustomLog /var/log/httpd/access.log common
</VirtualHost>
如果我http://server1.qa.com
没有打电话,app_dev.php
我会以这个错误结束:
由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,使用“LimitInternalRecursion”增加限制。使用“LogLevel debug”获取回溯。
如果我打电话,http://server1.qa.com/app_dev.php
一切都很好,应用程序可以工作。问题出在哪里?这是一个 Symfony 2.7 项目,我正在尝试DirectoryIndex
为该路径设置,有什么建议吗?
这是.htaccess
定义:
DirectoryIndex app.php
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
访问日志
access.log
如下几行所示,没有什么奇怪或有帮助的:
// called server1.qa.com
[04/Sep/2015:12:25:09 -0400] "GET / HTTP/1.1" 500 618
// called server1.qa.com/app_dev.php
[04/Sep/2015:12:25:14 -0400] "GET /app_dev.php HTTP/1.1" 302 340
[04/Sep/2015:12:25:14 -0400] "GET /app_dev.php/admin/login HTTP/1.1" 302 416
[04/Sep/2015:12:25:15 -0400] "GET /app_dev.php/login HTTP/1.1" 200 21521
[04/Sep/2015:12:25:16 -0400] "GET /app_dev.php/_wdt/c84bab HTTP/1.1" 200 40961