我的Awstats文件中有以下条目:
Unknown robot (identified by 'bot*')我怎么能阻止这个机器人?
我分别尝试了以下几种方法,但似乎没有一种方法能捕捉到它:
RewriteCond %{HTTP_USER_AGENT} ^bot*
RewriteCond %{HTTP_USER_AGENT} bot\*
RewriteCond %{HTTP_USER_AGENT} bot[*]下面是我使用的完整.htaccess代码:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^bot*
RewriteRule .? - [F,L]在第二行测试了三个regex值(^ bot *、bot\*、bot*),它们都没有停止bot。
发布于 2016-04-21 06:44:33
我们可以在.htaccess文件中使用机器人的确切名称来阻止机器人。下面的例子肯定会帮助您,目前我正在使用相同的设置,它节省了我的服务器资源。
SetEnvIfNoCase User-Agent "Yandex" bad_bot
SetEnvIfNoCase User-Agent "AhrefsBot" bad_bot
SetEnvIfNoCase User-Agent "MJ12bot" bad_bot
<IfModule mod_authz_core.c>
<Limit GET POST>
<RequireAll>
Require all granted
Require not env bad_bot
</RequireAll>
</Limit>
</IfModule>如果你有任何疑问请告诉我。
https://stackoverflow.com/questions/30936220
复制相似问题