ErrorDocument 403 无法通过其在 Apache 中的 403 访问拒绝访问
ErrorDocument 403 is not accessible by its 403 access deny in Apache
我在我的 Apache 服务器中 httpd.conf
实现了一个全局 IP 块,它显示了 403 错误文档中被禁止的 IP,但是 403 错误文档无法访问,因为被禁止的 IP 的访问再次被拒绝,因此它们可以'通过403错误查看403错误文档。它说 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
<Directory "${SRVROOT}/htdocs">
Options FollowSymLinks
AllowOverride None
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/error403.php"
</Directory>
<Location />
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/error403.php"
</Location>
这是我在 httpd.conf
中的访问控制代码。在不禁用全局IP块的情况下,应该在哪里处理才能允许被禁止的IP访问403文档?
要允许禁止的 IP 访问 403 错误文档,您应该创建一个目录并为其配置不同的访问级别。首先创建 errorpages
目录并在 httpd.conf
.
中实现此代码
<Directory "${SRVROOT}/htdocs/errorpages">
Require all granted
</Directory>
<Location /errorpages>
Require all granted
</Location>
此外,您需要将 ErrorDocument 403 "/error403.php"
更改为 ErrorDocument 403 "/errorpages/error403.php"
<Directory "${SRVROOT}/htdocs">
Options FollowSymLinks
AllowOverride None
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/errorpages/error403.php"
</Directory>
<Location />
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/errorpages/error403.php"
</Location>
那么他们就可以看到403错误文档了,但是仍然不允许他们看到你服务器中的其他页面。
我在我的 Apache 服务器中 httpd.conf
实现了一个全局 IP 块,它显示了 403 错误文档中被禁止的 IP,但是 403 错误文档无法访问,因为被禁止的 IP 的访问再次被拒绝,因此它们可以'通过403错误查看403错误文档。它说 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
<Directory "${SRVROOT}/htdocs">
Options FollowSymLinks
AllowOverride None
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/error403.php"
</Directory>
<Location />
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/error403.php"
</Location>
这是我在 httpd.conf
中的访问控制代码。在不禁用全局IP块的情况下,应该在哪里处理才能允许被禁止的IP访问403文档?
要允许禁止的 IP 访问 403 错误文档,您应该创建一个目录并为其配置不同的访问级别。首先创建 errorpages
目录并在 httpd.conf
.
<Directory "${SRVROOT}/htdocs/errorpages">
Require all granted
</Directory>
<Location /errorpages>
Require all granted
</Location>
此外,您需要将 ErrorDocument 403 "/error403.php"
更改为 ErrorDocument 403 "/errorpages/error403.php"
<Directory "${SRVROOT}/htdocs">
Options FollowSymLinks
AllowOverride None
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/errorpages/error403.php"
</Directory>
<Location />
<RequireAll>
Require all granted
Include conf/banlist.conf
</RequireAll>
ErrorDocument 403 "/errorpages/error403.php"
</Location>
那么他们就可以看到403错误文档了,但是仍然不允许他们看到你服务器中的其他页面。