【发布时间】:2011-08-25 19:27:15
【问题描述】:
我有这个使用 Zend 框架 (PHP) 的 URL http://xxxxxxxxx.com/account/session/login/redirect/%2Fhotel%2Frooms%2Findex%2Fhot_id%2F1。在 .htaccess 的帮助下
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]
问题是我收到了 404 Not found。为了确保它是 Apache,我在 index.php 主文件启动时退出了它,而 apache 仍然报告 404。在退出之前没有执行任何 php 代码。
编辑
我的域的 apache domlog 显示这一行
190.78.208.30 - - [25/Aug/2011:17:48:17 -0430] "GET /account/session/login/redirect/Fhotel%2Frooms%2Findex%2Fhot_id%2F1 HTTP/1.1" 404 25821 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0"
但error_log中没有关联的行
编辑 2
如果有用,我正在运行 Apache 2.2.19、PHP 5.3.6、cpanel 11.30.2、CentOS 5.6
请注意未找到 404。当我在执行任何其他操作之前退出 index.php 时,404 仍然出现。我可以确定 .htaccess 正在被读取。根据建议,我放了一个
SetEnv MYENV 1
并且出现在同一域中的 phpinfo() 中。我只是仔细检查了我的 access_log 和 error_log 并保持如上所述。
任何想法为什么会发生这种情况?
【问题讨论】:
-
错误日志应该准确显示 apache 试图为该请求加载的文件/路径。您还可以打开 mod-rewrite 调试以准确查看内容是如何被重写的。
-
试试这个:RewriteEngine on RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php
标签: php apache zend-framework http-status-code-404