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

相关推荐
deepwater_zone1 天前
主流的开源协议(MIT,Apache,GPL v2/v3)
apache·开源协议
lingggggaaaa1 天前
小迪安全v2023学习笔记(七十九讲)—— 中间件安全&IIS&Apache&Tomcat&Nginx&CVE
笔记·学习·安全·web安全·网络安全·中间件·apache
lifallen1 天前
Kafka 内存池MemoryPool 设计
数据结构·kafka·apache
闯闯桑2 天前
toDF(columns: _*) 语法
开发语言·前端·spark·scala·apache
A-刘晨阳2 天前
从全球视角到K8s落地的Apache IoTDB实战
kubernetes·apache·iotdb
管家婆客服中心3 天前
管家婆分销ERP A/V系列导出提示加载数据过大的处理方式
linux·服务器·apache
HashData酷克数据3 天前
官宣:Apache Cloudberry (Incubating) 2.0.0 发布!
数据库·开源·apache·cloudberry
XMYX-03 天前
解决 Apache/WAF SSL 证书链不完整导致的 PKIX path building failed 问题
网络协议·apache·ssl
IT·陈寒3 天前
怎么这么多 StringUtils —— Apache、Spring、Hutool 全面对比
java·spring·apache
程序员小潘3 天前
Dubbo3.3 Triple协议处理东西向流量
dubbo