屏蔽蜘蛛

:!: 需要屏蔽蜘蛛,进行规则修改和添加的,那么请务必自行创建新conf文件,而不要修改默认的conf文件,以免您其它站点调用而产生错误。

if ( $http_user_agent ~ AhrefsBot ){
   return 403;
}
if ( $http_user_agent ~ YandexBot ){
   return 403;
}
if ( $http_user_agent ~ MJ12bot ){
   return 403;
}
if ( $http_user_agent ~ DotBot ){
   return 403;
}
if ( $http_user_agent ~ RU_Bot ){
   return 403;
}
if ( $http_user_agent ~ Ezooms ){
   return 403;
}
if ( $http_user_agent ~ Yeti ){
   return 403;
}
if ( $http_user_agent ~ BLEXBot ){
   return 403;
}
if ( $http_user_agent ~ Exabot ){
   return 403;
}
if ( $http_user_agent ~ YisouSpider ){
   return 403;
}
if ( $http_user_agent ~ sandcrawlerbot ){
   return 403;
}
if ( $http_user_agent ~ ShopWiki ){
   return 403;
}
if ( $http_user_agent ~ Genieo ){
   return 403;
}
if ( $http_user_agent ~ Aboundex ){
   return 403;
}
if ( $http_user_agent ~ coccoc ){
   return 403;
}
if ( $http_user_agent ~ MegaIndex ){
   return 403;
}
if ( $http_user_agent ~ spbot ){
   return 403;
}
if ( $http_user_agent ~ SemrushBot ){
   return 403;
}
if ( $http_user_agent ~ TwengaBot ){
   return 403;
}
if ( $http_user_agent ~ SEOkicks-Robot ){
   return 403;
}
if ( $http_user_agent ~ WordPress ){
   return 403;
}
if ( $http_user_agent ~ BUbiNG ){
   return 403;
}
if ( $http_user_agent ~ PetalBot ){
   return 403;
}
if ( $http_user_agent ~ Adsbot ){
   return 403;
}
if ( $http_user_agent ~ NetcraftSurveyAgent ){
   return 403;
}
if ( $http_user_agent ~ Barkrowler ){
   return 403;
}
if ( $http_user_agent ~ serpstatbot ){
   return 403;
}
if ( $http_user_agent ~ MegaIndex.ru ){
   return 403;
}
if ( $http_user_agent ~ DataForSeoBot ){
   return 403;
}

注意,屏蔽蜘蛛的规则需要放在所有伪静态规则的上方。

案例

假设要屏蔽 AhrefsBot ,YandexBot ,MJ12bot 三种蜘蛛,假设站点是wordpress程序。

首先创建新的conf规则文件。



然后在 虚拟主机 => 对应的站点“编辑” => rewrite规则的下拉框中进行重新选择conf文件。

最后更改: in 2021/09/29 12:10