【发布时间】:2012-07-17 16:09:13
【问题描述】:
我正在尝试清理我的 apache 虚拟主机,因为我有许多“别名”,并且将它们全部放入 mod_rewrite 可能会很烦人。但是,虽然我可以自己访问特定的 URL(例如 http://example.dev/robots.txt、http://example.dev/,但虚拟主机不会回退到列出的 URL (FallbackResource /index.php)。
vhost 是 Zend Framework 项目的容器,没有设置 .htaccess 文件。
访问日志显示.... "GET / HTTP/1.1" 302 0,但谷歌浏览器显示“未收到数据”和“错误 324 (net::ERR_EMPTY_RESPONSE):服务器关闭连接但未发送任何数据。”
注释掉 FallbackResource 行,并重新启用基于 <Location /> 的 mod_rewrite 可以按预期工作。
编辑: 虚拟主机中没有任何东西可以阻止它工作。一些Alias 行(FallbackResource 应该使用)和一些FilesMatch 以停止访问具有特定扩展名的文件。日志中唯一出现的是 404,当它尝试访问 URL 而不是 index.php(列出的资源)时。
<VirtualHost *:80>
ServerAdmin webmaster@site.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/website/current/html/
SetEnv APPLICATION_ENV productionbackend
# must be most specific first
Alias /i/static /var/website/static/i
# more /i/* Alias
Alias /i /var/website/current/resources/common-furniture/
# protecting files in the directory.
<FilesMatch ".*\.xml">
Order allow,deny
Deny from all
</FilesMatch>
<Directory "/var/website/current/html/">
Options FollowSymLinks All
AllowOverride All
</Directory>
ErrorLog logs/error.log
CustomLog logs/access.log common
</VirtualHost>
【问题讨论】:
-
Apache 错误日志中的任何内容?
-
您的虚拟主机中是否有任何指令可能会阻止 FallbackResource 工作?请发布您的虚拟主机配置的较大部分。
-
你解决过这个问题吗?我也遇到了同样的问题。
-
我也遇到了同样的问题。我的虚拟主机非常简单pasted here,而我的 htaccess 只包含
FallbackResource index.html。也许你解决了这个@Marlun?