PHP404错误未重定向

PHP404错误未重定向,php,.htaccess,Php,.htaccess,因此,在编辑我的.HTACCESS文件时,我添加了适当的行来重定向遇到404和500等错误的用户。如果我告诉它显示特定的信息,它就像一个符咒。但是,如果我告诉该文件将用户重定向到自定义错误页,它将失败。 在测试我的404重定向时,我得到以下信息: Not Found The requested URL /143/test.php was not found on this server. Additionally, a 404 Not Found error was encountered wh

因此,在编辑我的.HTACCESS文件时,我添加了适当的行来重定向遇到404和500等错误的用户。如果我告诉它显示特定的信息,它就像一个符咒。但是,如果我告诉该文件将用户重定向到自定义错误页,它将失败。 在测试我的404重定向时,我得到以下信息:

Not Found
The requested URL /143/test.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80
正如您所看到的,这说明找不到我的ErrorDocument,但如果我在中键入我的ErrorDocument URL,我可以自己转到它。 我的.HTACCESS文件如下所示:

ErrorDocument 400 /error.php
ErrorDocument 401 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php
ErrorDocument 502 /error.php
ErrorDocument 504 /error.php

php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
# enable PHP error logging
php_flag log_errors on
php_value error_log PHP_errors.log
注意:我使用的是localhost(WAMP)。
谢谢。

您正在查找一个名为
“/143/test.php”
,但(通常)您的
。htaccess
位于web根目录中
.htaccess
正在
/143
目录中查找
错误.php
,因此请将其副本放在那里或在
中使用绝对URL。htaccess

已理解。在将/error.php更改为/143/error.php之后,它工作得很好。我不明白。htaccess这样查看根文件夹。谢谢:)