Start a project

Article · Technical SEO · AI crawlers · robots.txt · 12 min read

How to control AI crawlers without blocking Google

You can allow, limit or block AI crawlers without taking the site out of Google, but only if you treat training crawlers, search crawlers and user-triggered fetches as different things. Write the policy first, then apply it with robots.txt, HTTP headers, or firewall rules that name the right agents. A blanket “block bots” rule at the CDN is how people accidentally hide the site from Googlebot. Agent tokens change, so I will not pretend a list in this article is complete; use a current directory, and re-check when you change policy.

On this page 10 sections
  1. Crawlers, fetchers and training are not the same thing
  2. Start with a clear policy, then pick the mechanism
  3. robots.txt rules that name the right agents
  4. HTTP headers and X-Robots-Tag
  5. Firewall and CDN rules, and how they go wrong
  6. Usage policies, TDM and ai.txt
  7. Checking that Google can still get in
  8. A worked policy for a small UK site
  9. Key takeaways
  10. Frequently asked questions

I keep this split on leej.uk because I want pages to be searchable, I want to be careful about training, and I want a person who asked an assistant a question to still be able to fetch a page when that is appropriate. The llms.txt guide is about giving tools a map. This one is about who is allowed to request the pages at all.

Crawlers, fetchers and training are not the same thing

Three jobs get lumped together as “AI bots”, and they should not be:

A policy that says “no AI” without this split will either over-block (and hit Search, or hit a fetch a person asked for) or under-block (and allow a training crawler you thought you had stopped). You do not have to allow training in order to stay in Google. You do not have to block every fetch in order to opt out of training.

I cannot promise that every vendor honours robots.txt, or that they will keep the same token. Treat robots.txt as the baseline contract for well-behaved crawlers, and be honest about its limits.

Start with a clear policy, then pick the mechanism

Write the policy in a sentence you could publish. For a small UK site, a typical honest policy looks like one of these:

Once that sentence exists, pick mechanisms in this order:

  1. robots.txt, with User-agent tokens you have looked up, not guessed. This is the place well-behaved crawlers look, and it is the place you can change without redeploying a firewall.
  2. HTTP headers or X-Robots-Tag, when you need a rule on a specific response, or when a file is not HTML.
  3. Firewall or CDN rules, when you must stop a crawler that ignores robots.txt, or you need a rate limit. These are powerful and easy to get wrong.
  4. A published usage policy, sometimes called an AI usage policy, plus any TDM / ai.txt signals you want to offer as an extra hint.

Do not start at the firewall because it feels decisive. Start at the policy and robots.txt, then tighten. The AI usage policy builder can help you draft the public wording; the wording should still match the rules you actually ship.

robots.txt rules that name the right agents

robots.txt is matched by user-agent token, not by the word “AI” in a log. A rule for User-agent: * applies to everyone that does not have a more specific group, including Googlebot, unless you have also written a Googlebot group. That is the usual way a “block everyone, we’ll allow friends later” file takes a site out of Search.

A safer pattern is to leave the default open (or as open as you already have it), and to name the training crawlers you are opting out of:

# Example only — tokens go stale. Confirm names in a current directory.
User-agent: GPTBot
Disallow: /

User-agent: Google-Extended
Disallow: /

Those two names are examples of the kind of token you might use, including a training-specific token used by Google that is not Googlebot. I am not listing a complete set, and I am not promising those strings will be the right ones on the day you read this. Look them up in a current AI user-agent directory, then test the file with the AI crawler robots.txt tester and a general robots.txt tester.

Rules that keep you out of trouble:

robots.txt is public. Do not use it to hide a secret URL; use authentication.

HTTP headers and X-Robots-Tag

X-Robots-Tag and the HTML robots meta tag are for indexing and snippet behaviour (and some related directives) on a given response. They are useful when a URL should be crawlable but not indexed, or when you need a directive on a PDF or an image that has no HTML head.

They are a poor general substitute for “don’t train on this site”. Support for AI-specific header directives is uneven, and I will not invent a header name and tell you every vendor honours it. If a vendor documents a header or a meta tag, you can add it; still keep the robots.txt rule, which is the one they are more likely to have implemented.

Useful, well-established uses on a small site:

If you already have a canonical and a sitemap, do not use X-Robots-Tag to paper over a duplicate URL problem; fix the URLs, as in the canonical tags guide in this series.

Firewall and CDN rules, and how they go wrong

A WAF or CDN rule can block a crawler that ignores robots.txt, or cap a rude client, or challenge a junk path. It can also block Googlebot because your “bot score” rule was built for form spam, or because you matched Google in a user-agent and caught something you did not mean, or because you challenged every client without a particular header.

If you go this far:

The AI crawler firewall rules tool on this site is a way to draft cautious rules; it is not a substitute for reading what your CDN will actually match, and it will not verify Googlebot for you. I have seen a “block bad bots” preset take a site out of Search until someone looked at the 403s. Treat that class of preset as guilty until tested.

If you use Cloudflare or a similar worker-based host, as I do on this site, keep the allow/deny logic in one obvious place, and deploy it with the same care as a homepage change. A firewall rule is a production change.

Usage policies, TDM and ai.txt

A public usage policy will not, by itself, stop a crawler. It is still worth having, because humans, procurement teams and some tools look for it, and because it forces you to write the sentence I started with.

Alongside a policy page, there are emerging machine-readable hints: TDM (text and data mining) reservation signals, and various ai.txt or similar proposals. Treat these as additional, optional signals, not as a replacement for robots.txt, and not as a guarantee. If you add one, keep it consistent with the robots rules, and do not invent a syntax of your own and expect a crawler to guess it. Link the policy from /llms.txt if you have one, so a tool that only fetches the map can still find your terms.

The AI usage policy builder can produce a starting page. For a UK site, say where you are, what the site is, what is permitted, and that the policy is not a substitute for robots.txt or for the law. This is not legal advice; if you need a contractual or statutory position on mining, talk to a solicitor.

Checking that Google can still get in

Before you congratulate yourself on a training opt-out, prove that Search still works.

If you also care about other search engines, test those tokens the same way, one at a time. Do not assume a Google allowlist covers them.

A worked policy for a small UK site

Imagine a small studio site, like this one: a homepage, a projects list, a set of free tools, a handful of articles, and a contact page. The owner wants to stay in Google and other conventional search, to be careful about bulk training, and to allow a fetch when a person has asked a question about a public page.

The implementation I would actually ship:

  1. Publish a short policy page that says exactly that, and link it from the footer or the privacy page so a human can find it.
  2. Leave robots.txt open for * except where you already disallow admin or preview paths. Add specific Disallow: / groups for the current training-crawler tokens you have chosen from a directory, including a Google training token if you mean to opt out of that and if the current documented token is separate from Googlebot. Test that Googlebot is still allowed.
  3. Keep /sitemap.xml and /llms.txt allowed. Do not advertise private URLs in either file.
  4. Do not add a CDN “block all bots” preset. If a particular crawler ignores robots.txt and is a problem, add a narrow, reviewed rule, with Googlebot verification in mind, and log it.
  5. Recheck the directory and Search Console when you add a section of the site, and when a vendor announces a new agent name.

That is enough for most small sites. You can do more — rate limits, a TDM hint, a more aggressive firewall — but you should not do more until this version is tested and boring.

Key takeaways

If you want a second pair of eyes on a robots file or a crawler policy, tell me about it.

Frequently asked questions

How do I block GPTBot or ClaudeBot but keep Googlebot?

Add a robots.txt group for the current, documented token of each training crawler you want to opt out of, with Disallow: /, and do not add a site-wide Disallow for *. Confirm Googlebot is not covered by those groups, and test in Search Console. Look up the tokens at the time you write the file; names change, and Google also has training-related tokens that are not Googlebot.

Does robots.txt stop AI training crawlers?

It stops the ones that honour it, which many of the larger operators say they do, for the tokens they publish. It is not a legal lock and it is not a guarantee. For a crawler that ignores the file, you need a narrower technical control, and you should still have a public policy. Never confuse this with blocking Google Search.

What is the difference between a crawler and a user-agent fetch?

A crawler walks the site, often in bulk, for search or for training. A user-triggered fetch retrieves a URL because a person asked a question, around that time. Vendors may use different agents for the two. Your policy can allow one and deny the other; a single “block AI” rule cannot express that.

Should I use robots.txt, a firewall or an ai.txt policy?

Use robots.txt first, a public policy for humans and for extra signals, and a firewall only for crawlers that ignore the file or for rate limiting, after you have proved Googlebot still passes. ai.txt or TDM hints are optional and should agree with the robots file. They are not a substitute for it.

Can a CDN rule accidentally block Googlebot?

Yes, and it happens often: a “bot” preset, a challenge page, a user-agent match that was too broad, or an IP list that went stale. Allow verified search crawlers, test with Search Console after changes, and watch crawl errors. If you see 403s or challenge pages on your homepage in a Google fetch, fix the firewall before you touch content.

Written by Lee Johnson. Published 10 November 2026.

All articles · Swift A–Z · Apps

Questions, or an app in mind?

Let's bring your ideas to life. Whether you're envisioning a game-changing Apple Watch app or a transformative iOS experience, I'm here to make it happen.

Start a project