我一直对我的网站进行无意义的点击:
此外,如果重要,它是一个自托管的Wordpress网站。我已尝试过以下几种排列方式,但它无法正常工作:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} kw
RewriteRule ^(.*)$ - [F,L]
</IfModule>
编辑:我已经在一个单独的目录中测试了上面的代码,它工作正常。下面是Wordpress块,我把它缩小到:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} kw
RewriteRule ^(.*)$ - [F,L]
</IfModule>
# Use PHP5.3 Single php.ini as default
AddHandler application/x-httpd-php54s .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
答案 0 :(得分:1)
我能够通过将以下内容添加到.htaccess
的WP块中来解决这个问题# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# These 2 lines block any request coming in with `/?kw=`
RewriteCond %{THE_REQUEST} \s/+[^?]*\?kw=
RewriteRule ^ - [F,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress