apache 2.4版本的,在.haccess中添加如下形式的规则


在网站根目录下的.htaccess文件中,添加以下代码,如果当前没有.htaccess文件则自行创建一个

<If "(%{HTTP_USER_AGENT} =~ /AhrefsBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /YandexBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /MJ12bot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /DotBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /Ezooms/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /RU_Bot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /PetalBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /BLEXBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /Exabot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /sandcrawlerbot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /coccoc/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /ShopWiki/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /Genieo/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /Aboundex /i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /cococ/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /spbot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /SemrushBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /TwengaBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /SEOkicks-Robot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /WordPress/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /SeznamBot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /PetalBot/i)">
Require all denied
</If>

 <If "(%{HTTP_USER_AGENT} =~ /Adsbot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /NetcraftSurveyAgent/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /Barkrowler/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /serpstatbot/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /MegaIndex.ru/i)">
Require all denied
</If>

<If "(%{HTTP_USER_AGENT} =~ /DataForSeoBot/i)">
Require all denied
</If>
最后更改: in 2021/09/29 12:09