Apache2.2 FallbackResource不工作?

时间:2011-12-30 21:14:16

标签: apache2

所以我在Apache中配置了fallbackresource,将请求发送到webroot中的index.php,除非我在webroot目录中调用一个不存在的php文件,否则它似乎有效。例如,如果我尝试获取不存在的“/a.php”,则会出现404错误。但是如果我调用“/nodir/a.php”,它会按预期将它发送到index.php文件。

我搜索了谷歌,并阅读了该功能的Apache文档,但还没有找到原因。

我的设置 服务器版本:Apache / 2.2.20(Ubuntu) 在目录部分

下使用带有“FallbackResource /index.php”的默认配置的默认网站

有什么想法吗?

我能够使用mod_rewrite在.htaccess中使用以下基本行来正常工作,但显然更喜欢FallbackResource:

(.htaccess in webroot)
RewriteEngine On
RewriteCond /var/www/%{REQUEST_FILENAME} !-f
RewriteCond /var/www/%{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /a.php HTTP/1.1
HOST: localhost
Connection: close

HTTP/1.1 200 OK
Date: Sat, 31 Dec 2011 02:37:48 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.3
Vary: Accept-Encoding
Content-Length: 43
Connection: close
Content-Type: text/html

/a.php
localhost

Connection closed by foreign host.

0 个答案:

没有答案