> ## Documentation Index
> Fetch the complete documentation index at: https://learn.orbexa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# robots.txt AI爬虫访问控制配置

> 详解ChatGPT-User、GPTBot、Claude-Web、PerplexityBot等主流AI爬虫的User-Agent标识符与robots.txt访问控制配置策略，区分AI训练数据爬虫与实时浏览爬虫的差异化处理方式，提供电商网站推荐配置模板与常见配置错误排查指南

# robots.txt 优化

## 5.1 robots.txt基础

`robots.txt` 是一个放在网站根目录的纯文本文件（`你的域名/robots.txt`），告诉爬虫"哪些页面可以抓取，哪些不可以"。

所有遵守规范的爬虫（包括AI代理爬虫）在抓取你的网站前，都会先读这个文件。

## 5.2 传统爬虫 vs AI爬虫

2024-2026年，大量新的AI爬虫出现。它们和传统搜索引擎爬虫使用不同的User-Agent：

| 爬虫                | 所属         | User-Agent          | 用途                 |
| ----------------- | ---------- | ------------------- | ------------------ |
| Googlebot         | Google     | `Googlebot`         | 传统搜索索引             |
| Bingbot           | Microsoft  | `bingbot`           | 传统搜索索引             |
| ChatGPT-User      | OpenAI     | `ChatGPT-User`      | ChatGPT实时浏览        |
| GPTBot            | OpenAI     | `GPTBot`            | AI训练和搜索            |
| Claude-Web        | Anthropic  | `Claude-Web`        | Claude实时浏览         |
| ClaudeBot         | Anthropic  | `ClaudeBot`         | AI训练               |
| PerplexityBot     | Perplexity | `PerplexityBot`     | AI搜索引擎             |
| Applebot-Extended | Apple      | `Applebot-Extended` | Apple Intelligence |
| Bytespider        | 字节跳动       | `Bytespider`        | AI训练               |
| Google-Extended   | Google     | `Google-Extended`   | Gemini AI训练        |
| cohere-ai         | Cohere     | `cohere-ai`         | AI训练               |

## 5.3 推荐配置

对于希望最大化AI可见性的电商网站：

```
# 传统搜索引擎 — 允许全部
User-agent: Googlebot
Allow: /

User-agent: bingbot
Allow: /

# AI代理浏览 — 允许（这些代理会推荐你的商品）
User-agent: ChatGPT-User
Allow: /

User-agent: Claude-Web
Allow: /

User-agent: PerplexityBot
Allow: /

User-agent: Applebot-Extended
Allow: /

# AI训练爬虫 — 根据你的偏好决定
# 如果你希望被AI模型学习到（推荐）：
User-agent: GPTBot
Allow: /

User-agent: Google-Extended
Allow: /

# 如果你不希望内容被用于训练：
# User-agent: GPTBot
# Disallow: /

# 所有爬虫的通用规则
User-agent: *
Disallow: /admin/
Disallow: /checkout/
Disallow: /cart/
Disallow: /account/
Disallow: /api/

# Sitemap位置
Sitemap: https://你的域名/sitemap.xml
```

## 5.4 AI训练 vs AI浏览：一个重要区别

| 类型       | 代表爬虫                     | 作用            | 屏蔽后果           |
| -------- | ------------------------ | ------------- | -------------- |
| **AI浏览** | ChatGPT-User, Claude-Web | 用户提问时实时抓取你的网页 | AI代理无法看到你的最新内容 |
| **AI训练** | GPTBot, Google-Extended  | 抓取内容用于训练AI模型  | AI的知识库中不包含你的信息 |

**建议**: AI浏览爬虫必须允许（否则AI代理推荐你时看不到页面）。AI训练爬虫取决于你的态度，但允许训练通常意味着AI对你的品牌和商品有更好的理解。

## 5.5 各平台的robots.txt管理

### Shopify

Shopify通过主题文件 `robots.txt.liquid` 控制：

1. Online Store → Themes → Edit code
2. 找到 `robots.txt.liquid`
3. 添加你需要的AI爬虫规则

### WordPress / WooCommerce

WordPress自动生成 `robots.txt`。通过以下方式自定义：

1. **Yoast SEO**: SEO → Tools → File editor
2. **RankMath**: General Settings → Edit .htaccess & robots.txt
3. **手动**: 在WordPress根目录创建物理 `robots.txt` 文件（会覆盖WordPress自动生成的）

### 自建站

直接在网站根目录创建或编辑 `robots.txt` 文件即可。

## 5.6 常见错误

| 错误                         | 后果                | 修复                       |
| -------------------------- | ----------------- | ------------------------ |
| 完全没有robots.txt             | 所有爬虫默认允许（还行，但不专业） | 创建一个                     |
| `Disallow: /` 屏蔽所有         | AI代理看不到你的任何页面     | 改为只屏蔽管理页面                |
| 屏蔽了ChatGPT-User/Claude-Web | AI代理推荐你时无法获取实时内容  | 移除这些规则                   |
| 没有Sitemap声明                | 爬虫可能遗漏页面          | 添加 `Sitemap:` 行          |
| robots.txt有语法错误            | 规则可能不生效           | 用Google的robots.txt测试工具检查 |

## 5.7 验证

1. 访问 `你的域名/robots.txt` 确认文件存在且格式正确
2. 使用 [Google Robots Testing Tool](https://www.google.com/webmasters/tools/robots-testing-tool) 验证规则
3. 确认AI爬虫的User-Agent没有出现在 `Disallow` 规则中

***

**下一章**: [llms.txt编写指南](/zh/book-6/ch6-llms-txt) — 给AI代理的"公司简介"
