What a robots.txt file controls
Before a well-behaved crawler fetches a page, it reads /robots.txt at the root of the host. The file says which paths each crawler may request. It controls crawling, not indexing: a blocked URL can still appear in Google if other sites link to it. To keep a page out of search results, let it be crawled and add a noindex tag instead.
Each subdomain needs its own file. https://blog.example.com/robots.txt is separate from https://example.com/robots.txt, and a file in a subfolder is ignored.
How to create a custom robots.txt file
Most sites need only a few lines: one group for all crawlers that blocks private or duplicate areas, and a Sitemap line. Add a named group only when one crawler needs different rules.
A common starting point for a blog or business site, including a custom robots.txt for Blogger or WordPress:
- User-agent: * with Disallow lines for admin, login, cart, checkout and internal search result pages.
- No rules that block CSS, JavaScript or image folders: Google needs them to render the page.
- A Sitemap line with the full URL of your sitemap or sitemap index.
- For Blogger, paste the result into Settings, Crawlers and indexing, Custom robots.txt. For WordPress, upload the file to the site root or paste it into your SEO plugin's robots.txt editor.
Robots.txt rules for AI crawlers
AI companies publish the user-agent names their crawlers use, so you can allow or block each one. GPTBot (OpenAI), ClaudeBot (Anthropic), PerplexityBot (Perplexity) and CCBot (Common Crawl) each read their own group, and Google-Extended controls whether Google may use your content for Gemini.
Blocking a crawler is a trade-off. It keeps your pages out of that company's crawls, but it can also keep them out of the answers its assistant builds from crawled pages. Decide per bot, and check later which bots actually visit.
为什么在 2026 年你需要一个自定义的 Robots.txt 创建器
我们的免费 robots.txt 生成工具可帮助你为网站创建正确的 robots.txt 文件。
Robots.txt 文件对于控制搜索引擎如何抓取你的网站至关重要,并且会
显著影响你的 SEO 表现。
如何使用此 robots.txt 生成器
要生成 robots.txt 文件,只需选择您希望允许或禁止的机器人。
我们的 robots.txt 生成器随后会为您创建代码,供您复制和粘贴。
如何生成 Robots.txt 文件以阻止 AI 抓取工具(GPTBot、ClaudeBot)
随着 AI 代理的兴起,阻止 GPTBot、ClaudeBot 和 OpenAI-SearchBot 等 AI 抓取工具
比以往任何时候都更加重要,以保护您的知识产权。我们的工具可帮助您轻松
生成针对这些现代 AI 爬虫定制的指令。
核心功能
- 轻松配置: Simple interface to set up directives
- 预设模板: Quick templates for common use cases
- 自定义指令: Add custom allow, disallow, and other directives
- 即时生成: Get your robots.txt file ready for upload
- 无需注册: Use the tool immediately without signing up
常见用例
- 允许所有爬虫访问您的网站
- 阻止访问管理区域和私密内容
- 控制 API 端点的抓取
- 设置抓取延迟以保护服务器
- 指向您的 XML 站点地图
如何使用您生成的 robots.txt
- 下载生成的 robots.txt 文件
- 将其上传到您网站的根目录(例如:yourdomain.com/robots.txt)
- 监控您网站的抓取统计数据
最佳实践
- 保持您的 robots.txt 文件简单明了
- 在部署前测试您的 robots.txt 文件
- 不要使用 robots.txt 来隐藏敏感信息
- 在 robots.txt 中包含您的网站地图 URL
- 为大型网站设置合适的抓取延迟