gpt4 book ai didi

user-agent - 是否可以在一行中列出多个用户代理?

转载 作者:行者123 更新时间:2023-12-04 13:19:33 24 4
gpt4 key购买 nike

是否可以在 robots.txt 中向多个机器人发出一条指令而不必重复提及?

例子:

User-agent: googlebot yahoobot microsoftbot
Disallow: /boringstuff/

最佳答案

实际上很难给出一个明确的答案,因为 robots.txt 没有一个非常明确的标准,而且很多文档都含糊不清或相互矛盾。

description of the format understood by Google's bots很全面,包括这个稍微有点乱的句子:

Muiltiple start-of-group lines directly after each other will follow the group-member records following the final start-of-group line.



这似乎是在摸索以下示例中显示的内容:
user-agent: e
user-agent: f
disallow: /g

根据下面的解释,这构成了一个“组”,不允许两个不同的用户代理使用相同的 URL。

因此,您想要的正确语法(关于任何以与 Google 相同的方式工作的机器人)将是:
User-agent: googlebot
User-agent: yahoobot
User-agent: microsoftbot
Disallow: /boringstuff/

然而,正如 Jim Mischel 指出的,robots.txt 文件中没有一些机器人会正确解释的意义,但其他机器人可能会窒息,所以最好使用重复块的“最低公分母”,也许通过使用简单的“配方”和更新脚本动态生成文件。

关于user-agent - 是否可以在一行中列出多个用户代理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20294485/

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