robots.txt 中的指令顺序,它们是相互覆盖还是相互补充? [英] order of directives in robots.txt, do they overwrite each other or complement each other?

查看:32
本文介绍了robots.txt 中的指令顺序,它们是相互覆盖还是相互补充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

User-agent: Googlebot
Disallow: /privatedir/

User-agent: *
Disallow: /

现在,Googlebot 不允许使用哪些内容:/privatedir/或整个网站/?

Now, what are disallowed for Googlebot: /privatedir/, or the whole website / ?

推荐答案

根据原版robots.txt规范:

  1. 机器人必须遵循与其用户代理名称匹配的第一条记录.

  1. A bot must follow the first record that matches its user-agent name.

如果这样的记录不存在,它必须跟在带有User-agent: *的记录后面(这一行不能出现在多个记录中).

If such a record doesn’t exist, it must follow the record with User-agent: * (this line may not appear in more than one record).

如果这样的记录不存在,则不必遵循任何记录.

If such a record doesn’t exist, it doesn’t have to follow any record.

所以机器人永远不会跟踪多个记录.

So a bot never follows more than one record.

对于您的示例,这意味着:

For your example this means:

  • 不允许与名称Googlebot"匹配的机器人抓取路径以 /privatedir/ 开头的网址.
  • 与名称Googlebot"不匹配的漫游器不得抓取任何网址.

这篇关于robots.txt 中的指令顺序,它们是相互覆盖还是相互补充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆