gpt4 book ai didi

seo - Robots.txt 中的多个用户代理

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:27:24 25 4
gpt4 key购买 nike

在 robots.txt 文件中,我有以下部分

User-Agent: Bot1
Disallow: /A

User-Agent: Bot2
Disallow: /B

User-Agent: *
Disallow: /C

语句 Disallow:c 对 Bot1 和 Bot2 可见吗?

最佳答案

tl;dr:不,Bot1 和 Bot2 会愉快地抓取以 C 开头的路径。

每个机器人最多只能遵守 a single record (block) .

原始规范

original specification它说:

If the value is '*', the record describes the default access policy for any robot that has not matched any of the other records.

过期的 RFC 草案

原始规范,包括一些补充(如 Allow)成为 RFC 的草案,但从未被接受/发布。在 3.2.1 The User-agent line它说:

The robot must obey the first record in /robots.txt that contains a User-Agent line whose value contains the name token of the robot as a substring. The name comparisons are case-insensitive. If no such record exists, it should obey the first record with a User-agent line with a "*" value, if present. If no record satisfied either condition, or no records are present at all, access is unlimited.

因此它证实了原始规范的解释。

实现

谷歌,例如,gives an example这似乎符合规范:

Each section in the robots.txt file is separate and does not build upon previous sections. For example:

User-agent: *
Disallow: /folder1/

User-Agent: Googlebot
Disallow: /folder2/

In this example only the URLs matching /folder2/ would be disallowed for Googlebot.

关于seo - Robots.txt 中的多个用户代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14710324/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com