如何阻止Bots,不包括抓取工具访问我的网站?

时间:2016-06-26 13:54:25

标签: apache security bots

机器人每隔几分钟或几小时抓取一次我的网站,由于资源短缺,我的网站无法使用。僵尸来自俄罗斯

如何阻止此僵尸程序访问我的网站?

2 个答案:

答案 0 :(得分:1)

我已经解决了他的问题。

解决方案:

检查您网域的最新访问者 检查正在访问的用户代理。

就我而言,我找到了 YandexBot

Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)

现在您已经找到了降低服务器速度的机器人,请继续阻止它。您可以使用robots.txt.htaccess

执行此操作

.htaccess方法:

在其中添加以下代码。

#block bad bots with a 403
BrowserMatchNoCase "Yandex" bots
Order Allow,Deny
Allow from ALL
Deny from env=bots

或者

robots.txt方法:

在其中添加以下代码。

User-agent: Yandex
Disallow: /

那就是它。你已经阻止了机器人。

答案 1 :(得分:0)

拒绝指令应该在files部分内,尝试:

<Files 403.shtml>
order allow,deny
allow from all
deny from xxx.xxx.xx.xxx
</Files>

或者,你可以使用基于mod-rewrite的ip blocking

RewriteEngine on

RewriteCond %{REMOTE_ADDR} ^1\.2\.3\.4\.5$
RewriteRule  - [F]