apache、iis6、ii7獨立ip主機屏蔽攔截蜘蛛抓取(適用vps雲主機服務器)

發佈時間:2014-12-25

如果是正常的搜索引擎蜘蛛訪問,不建議對蜘蛛進行禁止,否則網站在百度等搜索引擎中的收錄和排名將會丟失,造成客戶流失等損失。可以優先考慮升級虛擬主機型號以獲得更多的流量或升級為雲服務器(不限流量)。更多詳情請訪問: http://www.west.cn/faq/list.asp?unid=626 

  

1. 使用網站管理助手環境:http://www.west.cn/faq/list.asp?unid=650 參考此說明啓用設置偽靜態組件

2.  windows2003+iis手工建站環境:http://www.west.cn/faq/list.asp?unid=639 參考此說明加載偽靜態組件                 

3.  然後在配置文件中按以下系統規則配置

 

Linux下 規則文件.htaccess(手工創建.htaccess文件到站點根目錄)

<IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT}   "Bytespider|Amazonbot|YisouSpider|ClaudeBot|GPTBot|meta-externalagent|SemrushBot|DotBot|BLEXBot|SMTBot|PetalBot|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>

windows2003下 規則文件httpd.conf 

#Block spider
RewriteCond %{HTTP_USER_AGENT}   (Bytespider|Amazonbot|YisouSpider|ClaudeBot|GPTBot|meta-externalagent|SemrushBot|DotBot|BLEXBot|SMTBot|PetalBot|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]

windows2008下 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="Bytespider|Amazonbot|YisouSpider|ClaudeBot|GPTBot|meta-externalagent|SemrushBot|DotBot|BLEXBot|SMTBot|PetalBot|Apache-HttpClient|SemrushBot|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|curl|perl|Python|Wget|Xenu|ZmEu|^$"   ignoreCase="true" />
      </conditions>
      <action   type="AbortRequest" />
</rule>
        </rules>  
        </rewrite>  
       </system.webServer>
  </configuration>

Nginx對應屏蔽規則

代碼需添加到對應站點配置文件server段內

if ($http_user_agent ~* "Bytespider|Amazonbot|YisouSpider|ClaudeBot|GPTBot|meta-externalagent|SemrushBot|DotBot|BLEXBot|SMTBot|PetalBot|Apache-HttpClient|Bytespider|Java|PhantomJS|SemrushBot|Scrapy|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|perl|Python|Wget|Xenu|ZmEu|^$"   )
{
  return 444;
}

注:規則中默認屏蔽部分不明蜘蛛,要屏蔽其他蜘蛛按規則添加即可

附各大蜘蛛名字:

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