# 为 AI 爬虫配置 robots.txt

> 把搜索爬虫和训练爬虫当作两个独立的决定。屏蔽 OAI-SearchBot 这样的搜索爬虫，网站会从该产品的回答中消失。屏蔽 GPTBot 或 Google-Extended 这样的训练标识，不影响搜索收录。

- URL: https://geo.casa/zh-cn/crawling-indexing/robots-txt-ai-crawlers/
- 指南 · 官方文档已说明
- 审核于: 2026-10-26

## 开始之前

- 你可以编辑并部署每个相关主机名下的 `/robots.txt`。
- 你清楚 CDN 或 WAF 是否也在拦截爬虫。Google 指出，抓取必须同时被「任何 CDN 或托管基础设施」允许，而不只是 robots.txt。

## 1. 按用途决定

| 用途 | 标识 | 如果禁止 |
|---|---|---|
| Google 搜索（含 AI 概览和 AI 模式） | `Googlebot` | 页面完全不会被抓取用于搜索。 |
| Gemini 的训练和依据生成；搜索 AI 功能背后模型的训练 | `Google-Extended` | 不影响搜索收录，也不影响 AI 概览的展示。 |
| ChatGPT 搜索结果 | `OAI-SearchBot` | 不会出现在 ChatGPT 搜索回答中（仍可能作为导航链接出现）。 |
| OpenAI 模型训练 | `GPTBot` | 表明内容不应用于训练。 |
| ChatGPT 中由用户发起的访问 | `ChatGPT-User` | robots.txt「可能不适用」；不用于决定搜索收录。 |
| Claude 搜索结果 | `Claude-SearchBot` | 内容不会被收录进 Claude 的搜索；「可能降低网站的可见度」。 |
| Claude 用户请求 | `Claude-User` | 用户询问时，Claude 无法读取你的页面。 |
| Anthropic 模型训练 | `ClaudeBot` | 之后的内容不进入训练数据集。 |
| Perplexity 搜索结果 | `PerplexityBot` | 不会出现在 Perplexity 搜索结果中。 |
| Perplexity 中由用户发起的访问 | `Perplexity-User` | 由于是用户发起，「通常忽略 robots.txt 规则」。 |

> **官方文档已说明:**
> OpenAI 说明 OAI-SearchBot 和 GPTBot 的设置相互独立。网站可以允许 OAI-SearchBot 以出现在 ChatGPT 搜索中，同时禁止 GPTBot。修改后大约 24 小时会在搜索中生效。
>
> 参考来源: [OpenAI: Overview of OpenAI crawlers](https://developers.openai.com/api/docs/bots)

> **官方文档已说明:**
> Anthropic 区分三个爬虫：ClaudeBot（训练）、Claude-User（用户请求时的访问）和 Claude-SearchBot（搜索索引）。屏蔽 ClaudeBot 表示之后的内容「应从我们的 AI 模型训练数据集中排除」。屏蔽另外两个可能降低网站在 Claude 中的可见度。Anthropic 还支持非标准的 `Crawl-delay` 指令，Google 则不支持。
>
> 参考来源: [Anthropic: Does Anthropic crawl data from the web, and how can site owners block the crawler?](https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler)

> **官方文档已说明:**
> PerplexityBot 用于在 Perplexity 搜索结果中呈现并链接网站，不用于为 AI 基础模型抓取内容。Perplexity-User 在用户提问时访问网页。由于是用户请求的访问，它「通常忽略 robots.txt 规则」。修改最多需要 24 小时生效。
>
> 参考来源: [Perplexity: Perplexity crawlers](https://docs.perplexity.ai/docs/resources/perplexity-crawlers)

> **官方文档已说明:**
> 对 Google 而言，AI 功能是搜索的一部分，因此针对 Googlebot 的 robots.txt 规则就是抓取控制方式。Google-Extended 作用于 Google 的部分其他 AI 系统，与搜索无关。
>
> 参考来源: [Google Search Central: AI features and your website](https://developers.google.com/search/docs/appearance/ai-features)

> **实践观察:**
> 2026 年 8 月的一次审计覆盖了 130 个公司网站的 robots.txt。做出明确选择的公司几乎没有一家封禁检索爬虫，它们只封训练类爬虫。研究作者认为，把两类爬虫一起封掉是「最容易犯、也最致命的一个错」。
>
> 参考来源: DATA17 AI Research Lab · 解数智能: 你的公司还在 AI 的答案里吗：企业 GEO 行动指南 · 2026 (未公开报告，没有公开链接，读者无法自行核对)

## 2. 编写规则

示例：出现在 Google、ChatGPT、Claude 和 Perplexity 的搜索中，同时退出模型训练。

```txt
user-agent: Googlebot
allow: /

user-agent: OAI-SearchBot
allow: /

user-agent: GPTBot
disallow: /

user-agent: Google-Extended
disallow: /

user-agent: Claude-SearchBot
allow: /

user-agent: ClaudeBot
disallow: /

user-agent: PerplexityBot
allow: /

user-agent: *
allow: /
```

爬虫只遵循与其名称匹配的最具体的那一组规则，所以 `*` 组里的规则不会叠加到具名的组上。

## 3. 验证

1. 获取线上文件：`curl -sA "OAI-SearchBot" https://example.com/robots.txt`。
2. 在 Google Search Console 中打开 robots.txt 报告，确认 Google 已获取新版本。
3. 检查服务器或 CDN 日志中各爬虫的请求，并对照厂商公布的 IP 段核实来源（OpenAI 为每个爬虫提供了 JSON 格式的 IP 列表）。

## 回滚

恢复之前的文件。Google 通常会在 24 小时内刷新缓存。

## 常见错误

- 本想屏蔽训练，却屏蔽了 `OAI-SearchBot`。
- 以为 [Google-Extended](https://geo.casa/zh-cn/crawling-indexing/google-extended/) 能把内容从 AI 概览中移除。它不能；请使用[搜索生成式 AI 控制](https://geo.casa/zh-cn/ai-search/search-generative-ai-control/)或摘要控制指令。
- robots.txt 已允许爬虫，但 WAF 规则仍返回 `403`。

## 参考来源

- [OpenAI: Overview of OpenAI crawlers](https://developers.openai.com/api/docs/bots)
- [Anthropic: Does Anthropic crawl data from the web, and how can site owners block the crawler?](https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler)
- [Perplexity: Perplexity crawlers](https://docs.perplexity.ai/docs/resources/perplexity-crawlers)
- [Google: Google's common crawlers](https://developers.google.com/crawling/docs/crawlers-fetchers/google-common-crawlers)
- [Google Search Central: AI features and your website](https://developers.google.com/search/docs/appearance/ai-features)
- [Google: How Google interprets the robots.txt specification](https://developers.google.com/crawling/docs/robots-txt/robots-txt-spec)
- DATA17 AI Research Lab · 解数智能: 你的公司还在 AI 的答案里吗：企业 GEO 行动指南 · 2026 (未公开报告，没有公开链接，读者无法自行核对)
