403 禁止错误显示,而不是自定义的错误 404 页面


403 Forbidden Error display instead of a customised Error 404 page

我的服务器遇到了这个问题,我正在尝试显示错误 404,但是当我转到无效的 URL 时,我收到此消息。请问问题从何而来?

        The requested URL /church/ffff.php     was not found on this server.
Additionallt, a 403 Forbidden error was        encountered while trying to use an           ErrorDocument to handle the request

谢谢。

哦,

这是因为HTaccess没有在本地主机上自动启用,您需要这样做:

  1. 点击 WAMP 图标
  2. Apache>Apache 模块>并启用rewrite_module

你的.htaccess是什么样的?

您可以添加如下自定义处理程序:

在 .htaccess 中(它的顶部是最好的)错误文档 404 404.php

服务器似乎

没有 404 文件的访问,要解决此问题,您应该将文件放在与 htAccess 相同的文件夹中,而不是写入完整路径(/c:wamp/www/church/404.php),您应该只写文件名 - 404.php