跳转到内容
搜索文档

robots.txt 设置

最后更新 查看 MarkdownAgent 设置

管理 robots.txt 文件以指导 AI bot 运营商获取内容抓取权限。 AI 公司使用爬虫收集网站内容,用于训练语言模型、生成搜索答案以及其他目的。域名根目录下的 robots.txt 文件会告诉这些爬虫它们应该或不应该访问哪些内容。当您开启托管 robots.txt 设置时,Cloudflare 会生成并维护一个 robots.txt 文件,指导已知的 AI 爬虫避开您的内容。

遵守 robots.txt 是自愿的。该文件表达了您的偏好,但它在技术层面上并不能阻止爬虫访问您的内容。一些爬虫运营商可能会忽略您的 robots.txt 指令(如 Disallow: / 等指令)并照样抓取您的内容。

与现有 robots.txt 文件的兼容性

Cloudflare 会检测您的源服务器是否已存在 robots.txt 文件,并进行相应调整 — 与您现有的文件合并,或从头开始创建一个。

现有的 robots.txt 文件

如果您的网站已经有一个 robots.txt 文件(通过 HTTP 200 响应进行验证),Cloudflare 会在我们托管的 robots.txt 之前添加内容,并将两者合并为单个响应。

例如,在不启用此功能的情况下,crawlstop.comrobots.txt 内容为:

未启用功能txt
User-agent: *
Disallow: /lp
Disallow: /feedback
Disallow: /langtest

Sitemap: https://www.crawlstop.com/sitemap.xml

启用托管 robots.txt 后,Cloudflare 将在我们托管的内容之前添加我们的内容,生成类似于您在 https://www.crawlstop.com/robots.txt 上看到的内容。

已启用功能txt
# As a condition of accessing this website, you agree to abide by the
# following content signals:

# (a)  If a content-signal = yes, you may collect content for the
#      corresponding use.
# (b)  If a content-signal = no, you may not collect content for the
#      corresponding use.
# (c)  If the website operator does not include a content signal for a
#      corresponding use, the website operator neither grants nor restricts
#      permission via content signal with respect to the corresponding use.

# The content signals and their meanings are:

# search: building a search index and providing search results (e.g., returning
#         hyperlinks and short excerpts from your website's contents). Search
#         does not include providing AI-generated search summaries.
# ai-input: inputting content into one or more AI models (e.g., retrieval
#           augmented generation, grounding, or other real-time taking of
#           content for generative AI search answers).
# ai-train: training or fine-tuning AI models.

# ANY RESTRICTIONS EXPRESSED VIA CONTENT SIGNALS ARE EXPRESS RESERVATIONS OF
# RIGHTS UNDER ARTICLE 4 OF THE EUROPEAN UNION DIRECTIVE 2019/790 ON COPYRIGHT
# AND RELATED RIGHTS IN THE DIGITAL SINGLE MARKET.

# BEGIN Cloudflare Managed content

User-Agent: *
Content-signal: search=yes, ai-train=no, use=reference
Allow: /

User-agent: Amazonbot
Disallow: /

User-agent: Applebot-Extended
Disallow: /

User-agent: Bytespider
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: GPTBot
Disallow: /

User-agent: meta-externalagent
Disallow: /

# END Cloudflare Managed Content
User-agent: *
Disallow: /lp
Disallow: /feedback
Disallow: /langtest

Sitemap: https://www.crawlstop.com/sitemap.xml

无 robots.txt 文件

如果您的网站没有 robots.txt 文件,Cloudflare 将创建一个新文件,其中包含针对已知 AI 爬虫的托管 Disallow 规则,并为您提供服务。

实施

要在您的域名上实施 robots.txt 文件:

  1. 在 Cloudflare 仪表板中,前往 Security settings(安全设置) 页面。

    Go to Settings ↗
  2. Bot traffic(Bot 流量) 过滤。

  3. 前往 Set a preference to block training in robots.txt(在 robots.txt 中设置阻止训练的偏好)

  4. 开启 Set a preference to block training in robots.txt(在 robots.txt 中设置阻止训练的偏好)

  1. 登录到 Cloudflare 仪表板,然后选择您的账户和域。
  2. 前往 Security(安全) > Bots
  3. 选择 Configure Bot Fight Mode(配置 Bot Fight Mode)
  4. 开启 Instruct bots with robots.txt(使用 robots.txt 指导 bot 流量)

内容信号策略 (Content Signals Policy)

内容信号 (Content Signals) 是 robots.txt 文件中的一组机器可读指令,用于分类爬虫如何使用您的内容。这三个类别是 search(构建搜索索引)、ai-input(将内容输入到 AI 模型中以获取实时答案)和 ai-train(训练或微调 AI 模型)。

对于没有自己的 robots.txt 文件且未使用托管 robots.txt 功能的免费版套餐域名,当爬虫请求您域名的 robots.txt 文件时,将显示内容信号策略 (Content Signals Policy)。

内容信号策略定义了这些类别,但并未表达关于您内容的任何特定偏好。要设置偏好(例如 ai-train=no),请开启托管 robots.txt 功能。

内容信号策略txt
# As a condition of accessing this website, you agree to abide by the
# following content signals:

# (a)  If a content-signal = yes, you may collect content for the
#      corresponding use.
# (b)  If a content-signal = no, you may not collect content for the
#      corresponding use.
# (c)  If the website operator does not include a content signal for a
#      corresponding use, the website operator neither grants nor restricts
#      permission via content signal with respect to the corresponding use.

# The content signals and their meanings are:

# search: building a search index and providing search results (e.g., returning
#         hyperlinks and short excerpts from your website's contents). Search
#         does not include providing AI-generated search summaries.
# ai-input: inputting content into one or more AI models (e.g., retrieval
#           augmented generation, grounding, or other real-time taking of
#           content for generative AI search answers).
# ai-train: training or fine-tuning AI models.

# ANY RESTRICTIONS EXPRESSED VIA CONTENT SIGNALS ARE EXPRESS RESERVATIONS OF
# RIGHTS UNDER ARTICLE 4 OF THE EUROPEAN UNION DIRECTIVE 2019/790 ON COPYRIGHT
# AND RELATED RIGHTS IN THE DIGITAL SINGLE MARKET.

当您开启 robots.txt settings(robots.txt 设置) 时,Cloudflare 的内容信号策略默认会包含在 robots.txt 文件中。

如果您想选择不在您的 robots.txt 文件中显示该策略,您可以在区域概述的 Control AI crawlers(控制 AI 爬虫) 下,取消勾选 Display Content Signals Policy(显示内容信号策略)

Go to Overview ↗

或者,您可以使用安全设置

内容使用信号 (Content use signal)

Cloudflare 正在测试 content-use,这是存在于您的 robots.txt 中的 Content Signals 的一个可选扩展。它在现有的 searchai-inputai-train 信号旁边添加了第四个字段,以描述爬虫在访问您的内容后可以保留和重用什么。该字段取以下三个值之一,从最不宽松到最宽松:

含义
use=immediate 允许交互,但不存储和重用任何内容。
use=reference 索引、摘录并链接回。
use=full 总结并复制。

对于开启了托管 robots.txt 设置的客户,Cloudflare 会在托管内容中添加 use=reference,与现有的默认值 search=yes,ai-train=no 保持一致:

包含 content-use 信号的托管 robots.txttxt
User-Agent: *
Content-signal: search=yes, ai-train=no, use=reference
Allow: /

可用性

适用于 AI 爬虫的托管 robots.txt 适用于所有套餐方案。

这篇文档对您有帮助吗?