Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

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

Apache 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我已使用我的.htaccess文件 提供404页 关闭目录扫描 以下是.htaccess文件的相关部分: Options -Indexes ErrorDocument 404 /Page-Not-Found.html 404部分工作正常 但是,转到目录(目录扫描)会返回以下信息: Forbidden You don't have permission to access /chihuahuaStories/2014/ on this server. Additionally, a 404 No

我已使用我的
.htaccess
文件

  • 提供404页
  • 关闭目录扫描
  • 以下是
    .htaccess
    文件的相关部分:

    Options -Indexes
    ErrorDocument 404 /Page-Not-Found.html
    
    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.
    

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

    Options -Indexes
    ErrorDocument 404 /Page-Not-Found.html
    ErrorDocument 403 /Page-Not-Found.html
    
    好的,多亏了a,我找到了解决方案,即提供以下内容:

    ErrorDocument 403 /Page-Not-Found.html
    

    迁移到新服务器后,我在WordPress网站上遇到了相同的错误

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

    我没有得到404的管理区或主页。只在页面和帖子上得到错误。我无意中纠正了这个错误。在管理区,我点击设置/permalink来检查permalinks是否与我以前的WordPress网站设置相匹配,它们确实匹配。所以,我点击了更新按钮。当我点击更新按钮修复问题时


    我想,当我单击permalink页面上的更新按钮时,它更新了.htaccess文件。

    您关闭了目录列表,因此
    被禁止
    。你期望的行为是什么?我认为它应该根据错误信息本身显示404页面。是的,惊人的巧合。但这也意味着您的Apache配置有一些其他的
    错误文档403…
    ,它们被这个.htaccess正确覆盖了。有没有一种方法可以让服务器为此提供默认值?我的.htaccess文件只有7行。是的,可能有一些默认值,但很明显,这些错误的默认值导致了额外的404