Every AI crawler checks your robots.txt file before it touches your site. That small text file tells crawlers which pages they may read, and it sits at the root of your site, at your own domain followed by robots.txt. If the file is missing, wrong, or too broad, the best product pages in the world will never be read by the systems that write AI answers.

This guide shows you how to write the file for AI search, using only crawler names the vendors themselves publish, and using only the rules the standard defines. It also shows you where robots.txt stops, because the file is a request, not a lock, and several important fetches ignore it altogether.

The short answer

Write one group per crawler, name the crawler with its published token, and give it an Allow rule for the pages you want found. Put the groups for AI search crawlers near the top of the file, before any broad block rules, because a crawler follows the group that names it and ignores the general group once it has its own. Keep training choices separate from search choices, because blocking a training crawler does not block search, and allowing a search crawler does not allow training.

The standard behind the file is RFC 9309, the Robots Exclusion Protocol. It says the rules are not a form of access authorisation, which means a well behaved crawler follows them, but the file does not stop a determined reader from opening a public page. It also says a crawler must use case insensitive matching to find the group that matches its product token, and if no matching group exists, it must obey the group with a star value, if present. The most specific matching rule wins, and if an allow rule and a disallow rule are equivalent, the allow rule should be used. If no rule matches, the page is allowed.

Google adds its own detail in its robots.txt guide. The file must be named robots.txt, it must sit at the root of the site host it applies to, it must be a UTF-8 encoded text file, and it applies only to the protocol, host, and port where it is posted. Google supports the fields user-agent, allow, disallow, and sitemap, and it says other fields such as crawl-delay are not supported. That last point matters: crawl-delay is not part of RFC 9309, and Google ignores it, so do not rely on it to slow Google crawlers.

How it works, step by step

Step one is to find the file. Open a browser and go to your own domain followed by robots.txt. If a page loads with rules in it, the file exists. If you see a not found error, the file does not exist yet and you need to create it at the root of your site, not in a subfolder. The exact place you create it depends on your platform, and your platform docs or your developer can tell you where the root file lives. Check the vendor docs in Sources before relying on a menu name or click path in any guide.

Step two is to read the groups. A group starts with one or more User-agent lines, followed by Allow and Disallow rules. Each group applies only to the crawlers it names. A crawler that finds a group with its own name follows that group and ignores the star group. That is the rule that catches most businesses out. A file with a star group that allows everything, plus a named group for one crawler that blocks everything, blocks that crawler, even though the star group says allow.

Step three is to decide the two separate questions. The first question is search: which crawlers may find and cite your pages in answers. The second question is training: which vendors may use your content to train future models. Keep them apart. OpenAI says each setting is independent of the others, and you can allow OAI-SearchBot in order to appear in search results while disallowing GPTBot to indicate that crawled content should not be used for training. Anthropic and the other vendors draw the same line in their own docs.

Step four is to write the search groups. The tokens below are the ones the vendors publish in their own documentation, and they are the only tokens this guide uses for search access:

Step five is to add the training groups as a separate decision. GPTBot is OpenAI training crawler, ClaudeBot is Anthropic training crawler, and meta-externalagent is Meta training crawler. Google-Extended is not a crawler at all. It is a standalone product token that tells Google whether content already crawled may be used to train future Gemini models and for grounding, and Google says it does not affect inclusion in Google Search and is not a ranking signal. Write each of those as its own group, with Allow or Disallow according to your choice, and never assume a training choice changes search visibility.

What to do on your site

Open the file and read it line by line before you change anything. Look for a star group with Disallow: / , which blocks every crawler that has no group of its own. Look for a named group that blocks a search crawler you actually want. Look for a typo in a token, because a misspelled token matches nothing, and the crawler falls back to the star group instead.

Then write the search allowlist near the top, before any broad block rules. The code block later in this guide shows a complete starting file you can adapt. Keep each group complete on its own. If you name a crawler, give that group all the rules it needs, because it will not borrow rules from the star group.

Then decide training, separately, in writing, with whoever owns the decision in your business. Training is a business choice about how your content may be used in future models, not a technical setting to copy from another site. Record the choice, the reason, and who made it, so the next person who edits the file does not undo it by accident.

Then save the file, reload it in a browser, and confirm the new rules appear. Remember that vendors cache the file. OpenAI says it can take about 24 hours from a robots.txt update for its systems to adjust for search. Perplexity says it may take up to 24 hours for its systems to reflect a change. Meta says to allow up to 24 hours because its crawlers may cache the file. Do not judge a change ten minutes after you make it. Retest the next day.

A worked example

Imagine a garden centre called Fern and Field that sells plants online and in a shop. Its site has product pages for plants, a blog with care guides, a cart, a checkout, and an admin area. The owner wants AI systems to find the product pages and the care guides, but not the cart, the checkout, or the admin area.

The owner opens the robots.txt file and finds a single star group with Disallow: / , left over from a site rebuild when the shop did not want search engines to index a half finished site. That one line blocks every crawler that has no group of its own, including OAI-SearchBot, Claude-SearchBot, and PerplexityBot. The shop has been invisible in AI answers for months, not because its plants are unpopular, but because a leftover block was never removed.

The owner replaces the file with the allowlist in the code block below, plus a star group that allows the public site but blocks the cart, the checkout, and the admin area. The search crawlers get their own groups with Allow: / , so they follow those groups and not the star group. The training crawlers get their own groups too, with a choice the owner records separately. The next day the owner checks the server logs and sees visits from OAI-SearchBot and PerplexityBot for the first time, and the product pages start to appear in AI answers over the following weeks.

The lesson is that a robots.txt file is a living document, not a file you write once and forget. A rebuild, a platform change, or a copied template can leave a block in place that no one remembers. Read the file whenever visibility drops, and read it again after any site change.

The machine readable part

Copy the block below as a starting point, replace yourdomain.com with your own domain, and adjust the private paths to match your own site. This file allows the main search crawlers, keeps training as a separate choice, and blocks the cart, checkout, and admin areas for all crawlers.

code
User-agent: OAI-SearchBot
Allow: /

User-agent: Claude-SearchBot
Allow: /

User-agent: PerplexityBot
Allow: /

User-agent: meta-webindexer
Allow: /

User-agent: Googlebot
Allow: /

User-agent: bingbot
Allow: /

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: meta-externalagent
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: *
Allow: /
Disallow: /cart/
Disallow: /checkout/
Disallow: /admin/

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

Two notes on this file. First, the training Disallow lines are an example choice, not a recommendation. Your business may choose to allow training crawlers instead. Make the choice deliberately and record it. Second, the star group at the end applies only to crawlers with no group of their own, because every named crawler above follows its own group instead. That is how RFC 9309 matching works, and it is why each named group must be complete.

Mistakes to avoid

Mistake one is using a training token to control search. Blocking GPTBot does not block ChatGPT search, and blocking ClaudeBot does not block Claude search. Search is controlled by OAI-SearchBot and Claude-SearchBot. Keep the two decisions apart.

Mistake two is treating Google-Extended as a crawler. It has no user agent string of its own, it never appears in server logs, and blocking it does not remove your pages from Google Search or AI Overviews. It only governs Gemini training and grounding for content Google already crawled.

Mistake three is relying on crawl-delay. Crawl-delay is not in RFC 9309. Google says it does not support it. Anthropic says it supports the non standard Crawl-delay extension, which is a vendor specific choice, not a standard rule. Do not put crawl-delay in a file and assume every crawler will slow down.

Frequently Asked Questions

Where does the robots.txt file live?

At the root of your site, at your own domain followed by robots.txt. It applies only to the protocol, host, and port where it is posted, so a file on your main domain does not cover a subdomain. Each subdomain needs its own file.

Does Allow: / mean a crawler can read my whole site?

Yes, for the paths that group covers, unless a more specific Disallow rule in the same group blocks part of it. The most specific matching rule wins, and if an allow and a disallow are equivalent, the allow should be used, under RFC 9309.