通過web.config或.htaccess規(guī)則文件屏蔽User_Agent(UA)訪問查找網(wǎng)站訪問較多的 User_Agent可通過“訪問統(tǒng)計(jì)”功能進(jìn)行查看,登錄進(jìn)入到虛擬主機(jī)管理面板點(diǎn)擊“訪問統(tǒng)計(jì)”。 進(jìn)入訪問統(tǒng)計(jì)詳細(xì)頁面--找到“瀏覽器 (前 10) 點(diǎn)擊:全部列出/版本 ”查看訪問占比較大的客戶端(User_Agent)瀏覽器版本。
如果某個(gè)特定的特征占的比例特別高,比如User_Agent為Amazonbot的占了90%,而Amazonbot對我們網(wǎng)站不是太重要的話,可按以下方式設(shè)置攔截。 屏蔽多個(gè)以"|"分隔,且同樣適用屏蔽蜘蛛的訪問爬行,規(guī)則如下: Linux主機(jī)下規(guī)則文件.htaccess(可手工創(chuàng)建.htaccess文件到站點(diǎn)根目錄)添加以下規(guī)則: <IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT} "Bytespider|Amazonbot|YisouSpider|^$" [NC]
RewriteRule !(^robots\.txt$) - [F]
</IfModule>Windows主機(jī)下規(guī)則文件web.config (可手工創(chuàng)建web.config文件到站點(diǎn)根目錄)添加以下規(guī)則: <?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|^$" ignoreCase="true" />
</conditions>
<action type="AbortRequest"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>網(wǎng)站流量超標(biāo)排查
|
|||||
| >> 相關(guān)文章 | |||||
|
|
|||||
400-028-5800
028-62778877
您好,非正常上班時(shí)間若有緊急技術(shù)問題,請撥總機(jī)后按7號鍵, 其他問題請?zhí)峤还位蛟谏习鄷r(shí)間聯(lián)系,謝謝支持!