与阻塞.htaccess文件错误的请求 [英] Blocking bad requests with .htaccess file
问题描述
我有一个网站,被击中用户打这个网址的变化 /index.php?s =
我试图阻止所有请求以下字符串应该摆脱所有的垃圾邮件发送者的 PHP?S =
的我似乎这个问题是具有是?和=在htaccess文件的保护角色,我就不能得到正确的语法。我怎样才能在下列情况下使用 PHP?S =
我已经试过
< IfModule mod_rewrite.c> RewriteEngine叙述上 的RewriteCond%{REQUEST_URI} ^(* PHP的?S =)。* [NC] 重写规则^(。*)$ - [F,L] < / IfModule>
和
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteCond%{REQUEST_URI} ^ * 1 = $&放PHP S;%{QUERY_STRING} * [NC]。
重写规则^(。*)$ - [F,L]
< / IfModule>
和
< IfModule mod_rewrite.c> RewriteEngine叙述上 的RewriteCond%{} THE_REQUEST ^ *(PHP = S $ 1安培;%{QUERY_STRING})。* [NC]。 重写规则^(。*)$ - [F,L] < / IfModule>
但没有任何工程。请帮助!
尝试
#ALL .PHP与S =在查询字符串请求
。的RewriteCond%{REQUEST_URI} ^ + \ PHP $ [NC]
的RewriteCond%{QUERY_STRING} ^ S =。* $ [NC]
重写规则。 - [F,L]
如果你想prevent S =
的查询字符串的任何位置。
#block S =在任何位置
的RewriteCond%{QUERY_STRING} ^(*&安培;)?S = * $ [NC]
I have a site that is getting hit by users hitting variations of this URL /index.php?s=
I am trying to block all requests to the following string which should get rid of all the spammers php?s=
The problem I seem to be having is the ? and = in the htaccess file are protected characters and I just can't get the syntax correct. How can I use php?s= in the following scenarios?
I have tried
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^.(*php?s=).* [NC] RewriteRule ^(.*)$ - [F,L] </IfModule>
and
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*php?s=$1&%{QUERY_STRING}.* [NC]
RewriteRule ^(.*)$ - [F,L]
</IfModule>
and
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{THE_REQUEST} ^.*(php?s=$1&%{QUERY_STRING}).* [NC] RewriteRule ^(.*)$ - [F,L] </IfModule>
But nothing works. Help please!
try
#all .php requests with s= in querystring
RewriteCond %{REQUEST_URI} ^.+\.php$ [NC]
RewriteCond %{QUERY_STRING} ^s=.*$ [NC]
RewriteRule . - [F,L]
If you want to prevent s=
in any querystring location replace the 2nd rewritecond above with
#block s= in any location
RewriteCond %{QUERY_STRING} ^(.*&)?s=.*$ [NC]
这篇关于与阻塞.htaccess文件错误的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!