Optimizing Robots.txt for AI SEO
Description
The robots.txt file is an exclusion protocol that tells crawlers which parts of the site to crawl or ignore.
Placed at the root of the domain, it defines access rules for each user agent, optimizes the crawl budget, and protects sensitive resources from indexing.
Why is this important for ai search?
AI engines use separate crawlers to index the pages they cite (OAI-SearchBot, Claude-SearchBot, PerplexityBot) and to train their models (GPTBot, ClaudeBot).
A poorly configured robots.txt can block indexing crawlers and remove you from generated answers.
An optimal configuration allows the crawlers that cite your pages and only blocks the uses you refuse.
Technical details
- Robots.txt file accessibility
- File format
- Directives for AI crawlers
- Rules for important sections and pages
1. Presence and accessibility of the robots.txt file
The file must sit at the root of each host. It is the first file crawlers read, including those of AI engines.
- Location: https://www.example.com/robots.txt. Every subdomain (blog.example.com, shop.example.com) needs its own file.
- Protocol: serve the file over HTTPS. A redirect from HTTP is fine.
- HTTP status code: the file must return a 200. A 404 means "everything is allowed": your directives simply do not exist. A 5xx error means "everything is disallowed" for crawlers that follow RFC 9309.
- Firewall and CDN: make sure they do not return a 403 to the AI crawlers you allow. The file is useless if the infrastructure blocks the visit.
2. Robots.txt file format
- MIME type: text/plain. A file served as text/html may be misread or rejected.
- Encoding: UTF-8.
- Size: under 500 KiB. Google ignores everything beyond that.
- Minimum content: at least one User-agent: * group followed by a rule, for example Allow: /.
3. Directives for AI crawlers
Every AI company now runs separate crawlers for each use. Your robots.txt should treat these three families differently.
- Indexing crawlers, allow: Googlebot (AI Overviews, AI Mode), Bingbot (Copilot), OAI-SearchBot (ChatGPT Search), Claude-SearchBot, PerplexityBot, Applebot, meta-webindexer, MistralAI-Index. Blocking them removes you from citations.
- On-demand agents, allow: ChatGPT-User, Claude-User, Perplexity-User, Meta-ExternalFetcher, MistralAI-User. They read a page when a user asks for it.
- Training crawlers, your call: GPTBot, ClaudeBot, CCBot, meta-externalagent, MistralAI-Training, plus the Google-Extended and Applebot-Extended tokens. Blocking them does not remove you from real-time answers, except from the Gemini app in the case of Google-Extended.
Example: cited in AI answers, no training
User-agent: OAI-SearchBot
User-agent: Claude-SearchBot
User-agent: PerplexityBot
User-agent: ChatGPT-User
Disallow: /admin/
Allow: /
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: CCBot
Disallow: /
User-Agent: __usage_ai-training
Disallow: /
User-agent: *
Disallow: /admin/
The shared __usage_ai-training token. Since October 30, 2026, this group expresses a training opt-out to Anthropic, OpenAI, Google and Microsoft. It changes nothing about crawling. Anthropic already applies it, Bing from February 1, 2027, OpenAI in the coming months and Google in 2027. Keep your crawler-by-crawler rules alongside it.
Watch out for Gemini. At Google, an opt-out through this token counts as a Google-Extended block, and Google-Extended also controls the Gemini app. AI Overviews and AI Mode are not affected: they rely on Googlebot.
Names to stop using. anthropic-ai, Claude-Web and FacebookBot are obsolete. GoogleOther is not an AI crawler: it is a generic Google crawler with no effect on Google Search or AI Overviews.
4. Rules for important sections and pages
- A crawler reads a single group: the one that names it. If it has its own group, it ignores User-agent: *. Repeat your general exclusions in every group.
- The longest rule wins: between Disallow: / and Allow: /blog/, Allow applies to /blog/. Line order does not matter. When both are the same length, Allow wins.
- Key pages: check that no rule blocks your articles, product pages or service pages.
- Deindexing: do not block a page to remove it from the index. A crawler that cannot read it cannot see its noindex tag.
- Sitemap: add the Sitemap line, which applies to the whole file whatever the group.
Sitemap: https://www.example.com/sitemap.xml
To go further, find the full list of AI crawlers, three ready-to-copy robots.txt files and a testing method in our complete guide to robots.txt and AI.