apache、iis规则屏蔽拦截ClaudeBot等蜘蛛爬虫抓取网页

如果是正常的搜索引擎蜘蛛访问,不建议对蜘蛛进行禁止,否则网站在百度等搜索引擎中的收录和排名将会丢失,造成客户流失等损失。但也有大量人工智能模型会爬取你的网页,这些就很没必要了,此时需要屏蔽这些蜘蛛爬虫访问。

Linux下规则文件.htaccess(手工创建.htaccess文件到站点根目录)

复制代码
<IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT} "Apache-HttpClient|SemrushBot|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|curl|perl|Python|Wget|Xenu|ZmEu" [NC]
RewriteRule !(^robots\.txt$) - [F]
</IfModule>

Windows2008、2012或更高系统下规则文件web.config (手工创建web.config文件到站点根目录)

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
   <rewrite>
    <rules>
     <rule name="Block spider">
      <match url="(^robots.txt$)" ignoreCase="false" negate="true" />
      <conditions>
      <add input="{HTTP_USER_AGENT}" pattern="Apache-HttpClient|SemrushBot|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|curl|perl|Python|Wget|Xenu|ZmEu" ignoreCase="true" />
      </conditions>
       <action type="AbortRequest"/>
     </rule>
    </rules>
   </rewrite>
  </system.webServer>
</configuration>

注:"{HTTP_USER_AGENT}"所在行中是不明蜘蛛名称,根据需要添加以"|"为分割。

规则中默认屏蔽部分不明蜘蛛,要屏蔽其他蜘蛛按规则添加即可,附各大蜘蛛名字:

google蜘蛛:googlebot

百度蜘蛛:baiduspider

百度手机蜘蛛:baiduboxapp

yahoo蜘蛛:slurp

alexa蜘蛛:ia_archiver

msn蜘蛛:msnbot

bing蜘蛛:bingbot

altavista蜘蛛:scooter

lycos蜘蛛:lycos_spider_(t-rex)

alltheweb蜘蛛:fast-webcrawler

inktomi蜘蛛:slurp

有道蜘蛛:YodaoBot和OutfoxBot

热土蜘蛛:Adminrtspider

搜狗蜘蛛:sogou spider

SOSO蜘蛛:sosospider

360搜蜘蛛:360spider

相关推荐
欧先生^_^1 天前
学习 Apache Kafka
学习·kafka·apache
欧先生^_^1 天前
Apache Spark 源码解析
大数据·spark·apache
w23617346011 天前
Apache中间件解析漏洞与安全加固
安全·中间件·apache
中科三方2 天前
APP和小程序需要注册域名吗?(国科云)
小程序·apache
Debug_TheWorld4 天前
Apache Flink 深度解析:流处理引擎的核心原理与生产实践指南
大数据·flink·apache
和算法死磕到底4 天前
ubantu18.04(Hadoop3.1.3)Hive3.1.2安装指南
大数据·数据库·hive·hadoop·mysql·hdfs·dubbo
Apache IoTDB5 天前
Apache IoTDB V2.0.2/V1.3.4 发布|新增表模型权限管理、UDF、嵌套查询功能
apache·iotdb
ashane13145 天前
Apache PDFBox
apache
三次握手四次挥手5 天前
基于Python+Pytest实现自动化测试(全栈实战指南)
开发语言·python·自动化·k8s·apache·pytest·代码规范
自由如风7096 天前
Apache Atlas构建安装(Linux)
linux·运维·apache