apache、iis6、ii7獨立ip主機屏蔽攔截蜘蛛抓取(適用vps云主機服務器)
如果是正常的搜索引擎蜘蛛訪問,不建議對蜘蛛進行禁止,否則網站在百度等搜索引擎中的收錄和排名將會丟失,造成客戶流失等損失??梢詢?yōu)先考慮升級虛擬主機型號以獲得更多的流量或升級為云服務器(不限流量)。更多詳情請訪問: http://www.west.cn/faq/list.asp?unid=626
1. 使用網站管理助手環(huán)境:http://www.west.cn/faq/list.asp?unid=650 參考此說明啟用設置偽靜態(tài)組件
2. windows2003+iis手工建站環(huán)境:http://www.west.cn/faq/list.asp?unid=639 參考此說明加載偽靜態(tài)組件
3. 然后在配置文件中按以下系統(tǒng)規(guī)則配置
Linux下 規(guī)則文件.htaccess(手工創(chuàng)建.htaccess文件到站點根目錄)
<IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT} "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下 規(guī)則文件httpd.conf
#Block spider
RewriteCond %{HTTP_USER_AGENT} (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="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對應屏蔽規(guī)則
代碼需添加到對應站點配置文件server段內
if ($http_user_agent ~ "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;
}
注:規(guī)則中默認屏蔽部分不明蜘蛛,要屏蔽其他蜘蛛按規(guī)則添加即可
附各大蜘蛛名字:
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
來源:西部數(shù)碼