尝试使用ErrorDocument时出现404 Not Found错误

use*_*155 22 php apache .htaccess http-status-code-404

我知道这个帖子已经在网上和这里谈了很多,我尝试了几乎所有的方法,但我仍然遇到同样的问题.

这是我本地服务器(MAMP)上的网址

http://localhost:8888/hellothere/index.php
Run Code Online (Sandbox Code Playgroud)

而且我试图插入错误的路径将我带到错误的页面,如下所示:

http://localhost:8888/hellothere/eiurgiuerib
Run Code Online (Sandbox Code Playgroud)

而不是带我到错误页面它显示:

Not Found

The requested URL /hellothere/eiurgiuerib was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Run Code Online (Sandbox Code Playgroud)

我的404页面位于Error目录中.在我的.htaccess文件中,我包含了这个:

ErrorDocument 404 /Error/404.php
Run Code Online (Sandbox Code Playgroud)

Sta*_*ble 46

ErrorDocument当提供本地URL路径时,该指令要求路径完全限定DocumentRoot.在您的情况下,这意味着实际的路径ErrorDocument

ErrorDocument 404 /hellothere/error/404page.html
Run Code Online (Sandbox Code Playgroud)