Guides ยท Crawler policy

How to Block (or Allow) AI Crawlers Without Breaking Google

Last verified: October 2026 ยท About 8 minutes of reading

There are four places to state or enforce a crawler rule, and only one is worth starting with. This guide gives copyable configuration for robots.txt, Cloudflare, Vercel and nginx, then shows the edit that takes a site out of Google Search โ€” a far more common mistake than an over-permissive AI policy.

Decide first: training vs search

Block training crawlers if you want to limit future models; block search crawlers and you leave today's answers.

The two groups are not interchangeable, and a single wildcard rule hits both. Training tokens are GPTBot, ClaudeBot, Google-Extended and CCBot. Search tokens are OAI-SearchBot, ChatGPT-User, Claude-User and PerplexityBot. The background on each is in the AI crawlers list.

Pick a policy before you write a rule.
GoalTraining groupSearch groupTokens blockedTypical effect
Stay in answersBlockAllow4 of 8Less training input; retrieval rules untouched
Full opt-outBlockBlock7 of 8 via robots.txtOut of training and out of indexes; ChatGPT-User needs an edge rule
Maximum exposureAllowAllow0 of 8Nothing changes; the default for most sites
One wildcard lineBlockBlockEvery agent, Googlebot includedAlso blocks Googlebot's CSS and JavaScript fetches

The last row is the tempting shortcut: one line, all eight tokens blocked. It also blocks Googlebot, which is the failure covered further down.

robots.txt syntax, crawler by crawler

One group per token, a blank line between groups, and a Disallow of / is enough to state the policy.

This block implements "block training, allow search". Multiple User-agent lines can share one group, so the three fetchers are combined and Google-Extended is listed separately for clarity:

# Block training crawlers
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: CCBot
Disallow: /

# Google-Extended is a token, not a fetcher:
# it controls Gemini training for pages Googlebot already crawled.
User-agent: Google-Extended
Disallow: /

# Allow retrieval crawlers explicitly
User-agent: OAI-SearchBot
Allow: /

# ChatGPT-User is user-initiated: robots.txt may not apply.
User-agent: ChatGPT-User
Allow: /

User-agent: Claude-User
Allow: /

User-agent: PerplexityBot
Allow: /

# Everything else keeps the default rules
User-agent: *
Disallow: /admin/
Disallow: /api/

Two AI-specific details decide whether this actually works:

The parsing rules underneath this block โ€” how groups form, why the longest match wins, what happens when the file returns a 404 or a 500 โ€” are the same for every crawler and are covered in the robots.txt guide.

Cloudflare

Since 15 September 2026 Cloudflare enforces three separate AI controls โ€” search, training and agents โ€” and its Block setting also stops Googlebot.

Older guides describe a single "Block AI Bots" switch, which Cloudflare retired on 15 September 2026. The replacement is three controls: Search, Training and Agent. The difference is not cosmetic โ€” Block and Block on pages with ads now apply to mixed-use crawlers such as Applebot, Bingbot and Googlebot, so blocking Training takes you out of traditional search too. The setting that refuses training while keeping search intact is Disallow AI Training.

  1. Open the zone, then Security, then Bots, then AI Crawl Control. A zone that has not migrated may still show the legacy switch.
  2. Read the Search control first. If it is set to Block, Googlebot and Bingbot are affected, not only AI crawlers.
  3. For Training, choose Disallow AI Training rather than Block if you want to stay discoverable.
  4. Agent controls govern on-demand fetchers. Block on pages with ads is the usual middle ground.
  5. Keep robots.txt consistent with the dashboard. Managed Robots.txt became Bot Preference Sync, which writes your choices into robots.txt.

New zones start with recommended defaults โ€” ad-supported sites with search allowed, training disallowed and agents blocked on ad pages; everything else with all three allowed. Review them rather than accept them.

What the edge layer cannot do: it cannot act on Google-Extended, because there is no request to match. It also cannot distinguish a real crawler from a client that copies its user agent unless you rely on verified bot checks. Treat the dashboard as enforcement and robots.txt as the statement of intent.

Vercel

On Vercel, robots.txt covers policy and a middleware or firewall rule covers enforcement; headers alone cannot match a user agent.

vercel.json can set headers and redirects per path, but it cannot branch on User-Agent. For a Next.js project on Vercel, the shortest enforcement path is middleware:

// middleware.ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

// Google-Extended is deliberately absent: it has no user agent.
const BLOCKED = ['GPTBot', 'ClaudeBot', 'CCBot'];

export function middleware(req: NextRequest) {
  const ua = req.headers.get('user-agent') ?? '';
  if (BLOCKED.some((token) => ua.includes(token))) {
    return new NextResponse('Forbidden', { status: 403 });
  }
  return NextResponse.next();
}

export const config = { matcher: '/:path*' };

On Pro and Enterprise plans, the Vercel firewall can express the same rule without a deploy. Either way, keep the robots.txt block above: middleware returns 403 to everything that matches, including a scraper, while robots.txt is what a well-behaved crawler reads first.

nginx

An nginx map on the user agent is the cheapest server-side block, as long as you accept that the header is forgeable.

# /etc/nginx/conf.d/ai-crawlers.conf
map $http_user_agent $block_training {
    default                                0;
    ~*GPTBot                               1;
    ~*ClaudeBot                            1;
    ~*CCBot                                1;
}

map $http_user_agent $block_search {
    default                                                    0;
    ~*(OAI-SearchBot|ChatGPT-User|Claude-User|PerplexityBot)   1;
}

server {
    listen 443 ssl;
    server_name example.com;

    # Enforces the training block only. Adding $block_search here
    # would also remove you from AI answers.
    if ($block_training) {
        return 403;
    }

    # To leave AI answers as well, uncomment:
    # if ($block_search) { return 403; }

    location / {
        try_files $uri $uri/ /index.html;
    }
}

Three notes. Both map blocks must live in the http context, so a file included from nginx.conf is the right home. The patterns are case-insensitive, which matters because some clients send lowercase. $block_search is defined but not enforced by default: uncomment the second condition only if you intend to leave AI answers too.

The misconfiguration that breaks Google too

A bare wildcard Disallow of / blocks Googlebot with everything else, and a Googlebot group only rescues part of the damage.

This is the version people paste after reading that "AI crawlers ignore robots.txt":

# Do not deploy this
User-agent: *
Disallow: /

# This line does not undo the damage for every other agent,
# and some crawlers never read it.
User-agent: Googlebot
Allow: /

# Google-Extended is not Googlebot. Blocking it is safe;
# blocking * is not.
User-agent: Google-Extended
Allow: /

What happens depends on whether the Googlebot group is present.

The second form is the trap: Search Console stops complaining about the main page, while image search, Bing, link previews and third-party verification quietly go dark.

The safe version keeps the wildcard permissive and blocks named tokens:

# Correct: block the crawlers you mean, leave everything else alone
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: Google-Extended
Disallow: /

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

The difference is one line of scope. The first file makes a statement about every crawler on the internet. The second names four tokens and leaves Googlebot, Bingbot and the rest untouched.

How to verify it worked

Verify the policy as data, then verify enforcement in logs; a curl with a forged user agent proves neither.

  1. Fetch the file. curl -s https://example.com/robots.txt should return your rules with status 200 and text/plain. Check that blank lines separate the groups.
  2. Read the policy back. For each of the eight tokens, decide whether the file allows or blocks the homepage and a deeper path. That is what the free AI readability check reports, without pretending to be a bot.
  3. Watch real traffic. Keep client IPs for a week and check which agents actually arrive. A blocked crawler disappears from logs; a spoofed one does not.
  4. Check Search Console after any wildcard change. Settings, then Crawl stats, then by response. A new "Blocked by robots.txt" line for Googlebot assets is the signal that you overreached; edge 403s appear in firewall events instead.

Note what this does not establish. A 200 from curl proves the file is served, not that a vendor obeys it. A 403 for a forged header proves your rule matches, not that the real crawler is affected. Those are the two claims most "I tested it" posts get wrong.

Frequently asked questions

Four questions cover the intent behind most block requests: search impact, scope, alternatives and timing.

Does blocking GPTBot remove me from ChatGPT?

Not directly. GPTBot is documented as a training crawler. Answers in ChatGPT search are fetched by OAI-SearchBot and ChatGPT-User, which are separate tokens. Blocking all three takes you out of training and out of the index, but OpenAI states robots.txt may not apply to the user-initiated ChatGPT-User, so only an edge rule reliably stops it.

Will blocking AI crawlers hurt my Google rankings?

Not if you block the right tokens. Google-Extended is a robots.txt token for Gemini training and does not affect Google Search. A wildcard Disallow for every agent does affect Search, because it blocks Googlebot and the CSS and JavaScript it needs to render pages.

Can I block AI crawlers without editing robots.txt?

Yes, at the network or edge layer, with two caveats. User agents can be forged, so you may block scrapers wearing an AI name and miss real crawlers. And Google-Extended has no user agent, so only robots.txt can control it.

How long does an AI crawler block take effect?

The next fetch after the rule is live, which for index crawlers can be days. Content already collected is not recalled: a block changes future behaviour, not copies that already exist in a corpus or an index.

Check any site free

See whether your rules allow or block all eight AI tokens, before you deploy anything.

Last verified: October 2026. Rules were checked against RFC 9309 and vendor crawler documentation on 2026-10-24; Cloudflare behaviour varies by zone age, so confirm it in your own dashboard.