htaccess通过querystring阻止请求 [英] htaccess block requests by querystring
本文介绍了htaccess通过querystring阻止请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一种方法可以用特定的查询字符串阻止所有请求?
There is a way to block all the requests with a certain querystring?
我应该阻止所有具有?userid = 1234"或& userid = 1234"的请求
I should block all the request that have "?userid=1234" or "&userid=1234"
例如:
/directory/page.php?userid=1234&var2=abc&var3=..
/directory/page.php?var1=test&userid=1234&var2=abc&var3=..
目录和页面始终相同.
我知道这是可能的,但是我不确定如何.
I know it's possibile, but i'm not sure how..
推荐答案
您可以检查QUERY_STRING
并测试它是否包含userid=1234
.
如果是这样,那就禁止它
You can check QUERY_STRING
and test if it contains userid=1234
.
If so, then forbid it
RewriteEngine on
RewriteCond %{QUERY_STRING} \buserid=1234\b [NC]
RewriteRule ^ - [F]
这篇关于htaccess通过querystring阻止请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文