# robots.txt 怎么写才能放行 AI 爬虫？

> 最简单的写法是对所有爬虫放行，并写上 sitemap 地址；只想屏蔽某一类时，再单独写那一类的 User-agent。

全部放行：

```
User-agent: *
Allow: /

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

只屏蔽训练类、保留搜索类（例子）：

```
User-agent: GPTBot
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: *
Allow: /
```

写完用浏览器打开 `你的域名/robots.txt` 确认能访问。另外检查 CDN 和防火墙有没有按 User-Agent 拦截，robots.txt 放行了、防火墙拦了，爬虫一样进不来。

## 相关问题

- [网站要不要屏蔽 AI 爬虫？](https://dapengkeji.com/ask/block-ai-crawlers.md)
- [llms.txt 是什么？怎么写](https://dapengkeji.com/geo/llms-txt.md)

---

来源：[robots.txt 怎么写才能放行 AI 爬虫？](https://dapengkeji.com/ask/robots-txt-ai) · 大鹏科技（dapengkeji.com）· 联系 hello@dapengkeji.com
