此外,尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误

Rob*_*ram 5 apache .htaccess mod-rewrite

我已经用我的.htaccess文件

  1. 提供404页面
  2. 关闭目录扫描。

这是文件的相关部分.htaccess

Options -Indexes
ErrorDocument 404 /Page-Not-Found.html
Run Code Online (Sandbox Code Playgroud)

404 部分有效。测试

但是,转到实际存在的目录(目录扫描)会返回以下内容:

Forbidden
You don't have permission to access /chihuahuaStories/2014/ 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)

anu*_*ava 3

在 .htaccess 顶部尝试以下指令:

Options -Indexes
ErrorDocument 404 /Page-Not-Found.html
ErrorDocument 403 /Page-Not-Found.html
Run Code Online (Sandbox Code Playgroud)