我使用htaccess技术阻止了一些IP地址,这对我的所有页面都适用,除了站点/文档根目录(显示Fedora Core Test Page的站点/文档根目录)之外。
我知道在根目录中找不到文档时会显示测试页,因此我创建了多个文档并设置了目录索引,其中index.php是我的常规文档根文件。
注意:我无权访问/etc/httpd/conf.d/welcome.conf
以下是相关的htaccess代码:
DirectoryIndex index.php index.html 403.php
ErrorDocument 403 /403.php
order allow,deny
deny from 5.39.218
deny from 146.0.74
deny from 5.39.219
deny from 176.102.38
allow from all
<FilesMatch "(403.php|hero.jpg|index.html)$">
order allow,deny
allow from all
</FilesMatch>
有没有一种方法可以显示网站根目录的自定义403页面?
任何建议将不胜感激。
寻找完整解决方案的人们:
完成的代码:
DirectoryIndex index.php index.html 403.php
ErrorDocument 403 /403.php
<FilesMatch "^.*$">
order allow,deny
allow from all
deny from 5.39.218
deny from 146.0.74
deny from 5.39.219
deny from 176.102.38
</FilesMatch>
<FilesMatch "^(|403\.php|hero\.jpg)$">
order allow,deny
allow from all
</FilesMatch>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句