加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – 阻止bingbot抓取我的网站

发布时间:2020-12-16 03:54:29 所属栏目:asp.Net 来源:网络整理
导读:我想完全阻止bing爬行我的网站(它以惊人的速度攻击我的网站(每月500GB的数据). 我有很多子域名添加到bing网站管理员工具,所以我不能去设置每个人的抓取速度. 我曾尝试使用robots.txt阻止它,但它无法正常工作 这是我的robots.txt # robots.txt User-agent: *D
我想完全阻止bing爬行我的网站(它以惊人的速度攻击我的网站(每月500GB的数据).

我有很多子域名添加到bing网站管理员工具,所以我不能去设置每个人的抓取速度.
我曾尝试使用robots.txt阻止它,但它无法正常工作
这是我的robots.txt

# robots.txt 
User-agent: *
Disallow:
Disallow: *.axd
Disallow: /cgi-bin/
Disallow: /member
Disallow: bingbot
User-agent: ia_archiver
Disallow: /

解决方法

这肯定会影响您的搜索引擎优化/搜索排名,并会导致页面从索引中删除,所以请小心使用

如果安装了iis重写模块,则可以根据用户代理字符串阻止请求(如果不是,则转到here)

然后像这样在webconfig中添加一条规则:

<system.webServer>
  <rules>
    <rule name="Request Blocking Rule" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_USER_AGENT}" pattern="msnbot|BingBot" />
      </conditions>
      <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this page." />
    </rule>
  </rules>
</system.webServer>

如果机器人命中你的网站,这将返回403.

UPDATE

看着你的robots.txt,我认为它应该是:

# robots.txt 
User-agent: *
Disallow:
Disallow: *.axd
Disallow: /cgi-bin/
Disallow: /member
User-agent: bingbot
Disallow: /
User-agent: ia_archiver
Disallow: /

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读