403重定向不工作 [英] 403 redirect doesn't work
本文介绍了403重定向不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何强制Apache将重定向到一个403错误?
我尝试过:
How to force apache to redirect to a 403 error?
I've tried:
RewriteRule ^forbid/(.*)$ / [R=403,L]
这引起了对整个网站的500服务器错误
this caused 500 server error on the whole site
RewriteRule ^forbid/(.*)$ - [R=403,L]
和
RewriteRule ^forbid/(.*)$ [R=403,L]
这些根本不工作
我有以下.htaccess文件:
these simply don't work
I have the following .htaccess file:
RewriteEngine on
RewriteRule ^(config|backup)(.*)$ - [F] [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin/(.*)$ /admin/index.php?%{QUERY_STRING} [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !util
RewriteRule ^(.*)$ index.php?%{QUERY_STRING} [L,QSA]
请帮帮我!
推荐答案
试试这个来代替:
RewriteRule ^forbid/(.*)$ - [F]
来源:<一href="http://httpd.apache.org/docs/current/rewrite/flags.html#flag_f">http://httpd.apache.org/docs/current/rewrite/flags.html#flag_f
这篇关于403重定向不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文