.htaccess不会重定向到自定义404页面

时间:2014-10-27 19:29:27

标签: php .htaccess mod-rewrite redirect

我目前在自己的网站上工作,该网站在本地Apache服务器上运行 我有一个 .htaccess 文件,它应该将404错误重定向到自定义页面。
这是:

ErrorDocument 404 /404.php

但我得到的是以下错误,而不是我的自定义404页面:

Not Found

The requested URL /my-site/gqehgr 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 (Win32) PHP/5.5.12 Server at localhost Port 80

我在几个论坛上看到我可以使用RewriteEngine,但我不明白它是如何工作的。
有人有线索吗?

修改:
该行应该是:

ErrorDocument 404 /my-site/404.php

1 个答案:

答案 0 :(得分:1)

找不到您的404.php。检查你的文件。尝试手动请求/404.php

相关问题