挡错爬虫标识,llms.txt 等于没写:20 站复核
一句话结论:llms.txt 能不能被 AI 读到,先取决于 robots.txt 有没有把读取方挡在门外;而在 Tranco 前 1 万站里,18.8% 的站点至少封了一个 AI 爬虫,其中还有一批只封了 Anthropic 已停用的旧标识。
背景:文件发了,读取方进不来
llms.txt 这两年被当成"让 AI 读懂站点"的标配动作。但落地时最常见的失配不是文件写错,而是三件事没对齐:
- 爬虫不是一类东西。GPTBot 抓训练数据,OAI-SearchBot 抓 ChatGPT 搜索索引,ChatGPT-User 是用户在对话里让模型现场打开网页。三者用途不同,封一个不等于退出另一个。
- Anthropic 换了标识。
anthropic-ai已停用,现在实际抓取的是ClaudeBot(训练)和Claude-SearchBot(搜索)。只封旧名,等于一个都没封。 - 文件写了没人能取。robots 里一道
Disallow: /下来,llms.txt 再怎么精心排版也只是一个静态文本文件。
本机 2026-12-02 对 20 个域名做了一次 robots.txt 与 llms.txt 的双向复核,样本里出现了一个非常干净的规律:发布 llms.txt 的站点一个都没封 AI 爬虫,封了 AI 爬虫的站点一个都没发布 llms.txt。这两个动作本质是同一套决策的两面。
落地清单
一、先把 AI 爬虫按用途分成三类
| 用途 | 代表 UA | 封它的后果 | 放开它的代价 |
|---|---|---|---|
| 训练 | GPTBot、ClaudeBot、CCBot、Bytespider、Google-Extended、Applebot-Extended、meta-externalagent | 训练语料里没有你,未来模型不认识你的品牌 | 内容进入训练集,无法撤回 |
| AI 搜索 | OAI-SearchBot、Claude-SearchBot、PerplexityBot | ChatGPT / Claude / Perplexity 的检索结果里没有你 | 被引用、被导流的概率上升 |
| 用户触发 | ChatGPT-User | 用户在对话里要求"打开这个链接"时抓不到 | 页面被按需读取,流量回到源站 |
Google-Extended 是 Gemini 训练用的开关,不影响 Google 搜索收录,也不影响 Search Console 数据——它和服务商给的那堆"AI 爬虫"不是一码事。
二、robots.txt 按"用途分组"写,别按"一串 UA"写
最省事也最不容易写错的形态是三段:训练组封、搜索组放、其余按常规站点管。下面这段可直接抄,只改 * 组里的路径:
# 1) 训练爬虫:一律不抓
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: CCBot
User-agent: Bytespider
User-agent: Google-Extended
User-agent: Applebot-Extended
Disallow: /
# 2) AI 搜索与用户触发:全站放行(要的就是被引用)
User-agent: OAI-SearchBot
User-agent: Claude-SearchBot
User-agent: PerplexityBot
User-agent: ChatGPT-User
Allow: /
# 3) 常规站点规则
User-agent: *
Disallow: /admin/
Disallow: /*?s=
三条 RFC 9309 的判定规则必须记住,否则写得再整齐也会被误判:
- **点名分组优先于
*组**,两者不叠加; - 同名分组合并,写两个
User-agent: GPTBot段落等于合并成一段; - 最长匹配优先,平局时 Allow 胜出——所以
Disallow: /加Allow: /blog/是"只开博客"的意思。
还有一个反直觉的写法要避开:Disallow: / 配 Allow: /$。$ 只匹配行尾,效果是只放行首页、封掉全部内容页,等于整站封禁。
三、llms.txt 的位置、形态与"能不能被找到"
文件本身不需要复杂结构,# H1 + > 摘要 + ## 分节 + 链接列表 四类元素就够。真实可对照的例子是 wordpress.org 的根文件(2026-12-02 本机抓取,5,765 字节,200 / text/plain):
# WordPress
> WordPress is the free, open-source content management system (CMS) that powers more than 43% of all websites on the internet. ...
WordPress is software you own. It runs on your own hosting, stores content in your own database, and is fully extensible through its REST API, Block Editor, and ecosystem of more than 60,000 plugins and 13,000 themes
要让代理"知道这个页面有 llms.txt",v2 提案补了两个关系属性(社区修订,非 LLM 厂商官方确认):
<link rel="alternate" type="text/markdown" href="/docs/quickstart.md">
<link rel="describedby" href="/llms.txt">
放在 <head> 里,或者对非 HTML 资源用响应头下发:
Link: </docs/quickstart.md>; rel="alternate"; type="text/markdown", </llms.txt>; rel="describedby"
四、发布后的四步验证(比"打开了 200"重要)
# 1. 状态码与 MIME(必须是 text/plain 或 text/markdown,不能回落到 text/html)
curl -sI https://example.com/llms.txt | grep -Ei 'HTTP/|content-type'
# 2. 首行必须是 "# 标题",这是多数解析器的识别条件
curl -s https://example.com/llms.txt | head -1
# 3. 换成 AI 爬虫 UA 再取一次,验证没被 robots/CDN 拦
curl -s -o /dev/null -w '%{http_code}\n' -A "OAI-SearchBot/1.0" https://example.com/llms.txt
# 4. 确认 robots 里没有把读取方封掉(活体判定,不是看文本)
curl -s https://example.com/robots.txt
第 3 步是本次复核里最有信息量的一步:同一份 llms.txt,普通 UA 取是 200,搜索爬虫 UA 取可能被 CDN 规则打成 403。robots.txt 只是君子协定,边缘层按 UA 拦截是另一道门,只测前者等于没测。
结果
研究方口径:Tranco 前 1 万站(抓取 2026-09-28)
| 指标 | 数值 |
|---|---|
| 有 robots.txt 的站点 | 4,592 |
| 至少封一个 AI 爬虫(同时放行 Googlebot) | 18.8% |
| 封全部 15 个 AI 爬虫 | 2% |
| 挡训练、放 AI 搜索 | 9.4% |
| 提供 llms.txt 的可访问站点 | 10.7%(其中至少 30 个由 Yoast SEO 插件生成) |
只封 anthropic-ai、未封 ClaudeBot 的站点 | 37 个(含 espn.com、science.org、trustpilot.com) |
分爬虫屏蔽率(分母 4,592):CCBot 14.3%、GPTBot 13.4%、Bytespider 13.3%、ClaudeBot 12.3%、meta-externalagent 10.6%、Google-Extended 10.5%、Applebot-Extended 9.8%、PerplexityBot 8.9%、ChatGPT-User 7.4%、OAI-SearchBot 5.3%、Claude-SearchBot 5.2%;对照的 Googlebot 3.3%。封 GPTBot 的 615 个站点里,373 个(60.7%)仍放行 OAI-SearchBot。
本机复核:20 个域名(2026-12-02,Python 标准库直取原始字节)
| 域名 | robots.txt | 被封的 AI 爬虫 | /llms.txt |
|---|---|---|---|
| espn.com | 200 / 3,223 B | GPTBot、anthropic-ai、Google-Extended、CCBot、ChatGPT-User | 404 |
| science.org | 200 / 939 B | GPTBot、anthropic-ai、Google-Extended、CCBot | 403 |
| trustpilot.com | 200 / 25,037 B | anthropic-ai(仅旧标识) | 403 |
| techcrunch.com | 200 / 608 B | GPTBot、ClaudeBot、anthropic-ai、CCBot | 404 |
| sitepoint.com | 200 / 2,853 B | GPTBot、Google-Extended、CCBot | 404 |
| walmart.com | 200 / 3,479 B | 无 | 404 |
| smashingmagazine.com | 200 / 13,053 B | 无 | 404 |
| mozilla.org | 200 / 66 B | 无 | 404 |
| shopify.com | 200 / 62 B | 无 | 200 / text/plain / 12,642 B |
| cloudflare.com | 200 / 1,097 B | 无 | 200 / text/plain / 17,173 B |
| wordpress.org | 200 / 976 B | 无 | 200 / text/plain / 5,765 B |
| stackoverflow.com | 403 | 不可判定 | 403 |
统计口径与限制:
- 12 个域名 robots.txt 可读,其中 5 个至少封一个 AI 爬虫;这 5 个全部没有可读的 llms.txt(3 个 404、2 个 403)。
- 3 个发布 llms.txt 的域名(shopify.com / cloudflare.com / wordpress.org),AI 爬虫封锁数为 0。
- 另 8 个域名(nytimes.com、theguardian.com、bbc.com、reuters.com、forbes.com、medium.com、github.com、wikipedia.org)本机请求全部异常返回(连接超时或被重置,状态码 0),不计入统计,不作任何结论依据。
- espn.com 的实际分组值得抄下来看:五个 UA 各写一段、每段只有
Disallow: /,ClaudeBot与Claude-SearchBot均未出现——这正是"以为封了 Anthropic,其实封的是旧名"的原型。 - techcrunch.com 是反面参照:
ClaudeBot、GPTBot、anthropic-ai、CCBot四段并列,一个不漏,属于"明确不想被训练"的干净写法。
复盘
三条可以直接抄的配置
- UA 分组按用途写三段(训练封 / 搜索放 / 常规管),不要让一个
User-agent: *承担所有决策;新爬虫上线时只需改对应分组,不必重写文件。 - 封 Anthropic 写
ClaudeBot,搜索侧写Claude-SearchBot;anthropic-ai只作为历史兼容保留一行即可,别当成唯一开关。 - 发布 llms.txt 后跑四步验证,尤其第三步——用
OAI-SearchBot/1.0的 UA 实际取一次文件,确认边缘层没把它打成 403。
两条踩坑提醒
- 别只放行首页。
Disallow: /+Allow: /$在判定上等同于整站封禁,只有首页可抓,内容页全丢。要放行子树就写Allow: /docs/。 - 别把"挡住 GPTBot"当成"退出 ChatGPT"。GPTBot 管训练;ChatGPT 搜索用 OAI-SearchBot,用户当场打开网页用 ChatGPT-User。三者分开写,也分开验证。
标注
- llms.txt 版本:v1 主体格式 + v2 的
rel="alternate" type="text/markdown"/rel="describedby"关系属性(社区提案,2026-08 修订),规范状态为作者与社区主张,未获 LLM 厂商官方确认。 - robots 判定口径:RFC 9309(点名分组优先、同名分组合并、最长匹配优先、平局 Allow 胜出,支持
*与$)。 - 数据来源:研究方 CallAI-Research/1.0 于 2026-09-28 抓取 Tranco 前 10,000 个域名(榜单 ID 64X3X),18.8% / 10.7% / 37 个旧标识站点等数值为该研究方自述,非第三方复现;本机 20 站复核为 2026-12-02 直连实测,可复跑。
- 未取得任何排名、流量、AI 引用量数据,本文不对 llms.txt 的收益作量化结论。
标签:llms.txt、AI可见度、AIWO、结构化暴露、robots.txt、AI爬虫