首页 / 标准文件 · robots.txt

robots.txt 规范

门卫协议写错,后面所有优化都进不了门。

它是什么

/robots.txt 是爬虫的门卫协议。SEO 时代它管百度/谷歌;GEO 时代它还要管 GPTBot、ClaudeBot、Bytespider 等。写错一行,可能把整站从某家 AI 的视野里抹掉。

GEO 友好的最小范例

User-agent: *
Allow: /
Disallow: /admin
Disallow: /checkout

User-agent: GPTBot
Allow: /

User-agent: OAI-SearchBot
Allow: /

User-agent: ClaudeBot
Allow: /

User-agent: Googlebot
Allow: /

User-agent: Bytespider
Allow: /

User-agent: Baiduspider
Allow: /

Sitemap: https://example.com/sitemap.xml

训练与搜索要分开

若法务要求「可以被搜、不要被拿去训练」,应对 Google-Extended、GPTBot(训练向)单独写规则,同时保证 Googlebot、OAI-SearchBot、ChatGPT-User 仍能抓取公开页。具体名单见 AI 爬虫名录。

规则

  • 一行一个 User-agent,分组写,不要混在一起难以阅读。
  • Disallow: / 对某个 Bot 等于退出该生态的 GEO。
  • Sitemap 行写绝对地址。
  • 文件必须是 text/plain,不能是 HTML。
  • WAF / 防火墙不要把合规爬虫当攻击。