VisibilyRanking
All posts
By VisibilyRankingrobots.txtAI crawlersTechnical

robots.txt for AI crawlers: a practical guide with sample rules

How to write robots.txt rules for AI crawlers without blocking the ones that decide your visibility, with sample configurations and a testing routine.

Robots.txt is a plain text file at the root of your domain. It tells crawlers which paths they may fetch. It's voluntary: well-behaved bots follow it, bad ones ignore it. For AI search, it's still the first file to get right, because a careless line can quietly remove you from answers.

This guide covers how to structure the file for AI crawlers, shows a few sample setups, and explains how to test the result.

How the file is read

Rules are grouped by user agent. A crawler finds the group that names it most specifically and follows only that group. If no group names it, it falls back to User-agent: *.

Two consequences follow. First, a specific group overrides the wildcard completely; it doesn't add to it. Second, an empty Disallow: line means "allow everything," while Disallow: / means "allow nothing." Mixing those up is the single most common mistake.

Know the names before you write rules

Use each vendor's documented user agent names, not guesses. A few that matter for AI search:

  • OpenAI: GPTBot, OAI-SearchBot, ChatGPT-User
  • Anthropic: ClaudeBot, Claude-User, Claude-SearchBot
  • Perplexity: PerplexityBot, Perplexity-User
  • Google: Google-Extended is a control token for AI use of content, separate from Googlebot

Vendors update these. Check the current documentation before you publish, and don't invent agent names, because a rule for a bot that doesn't exist does nothing.

The pattern worth noticing: most vendors now separate training crawlers, search crawlers, and user-triggered fetchers. They aren't interchangeable, so blocking by vendor name alone is too blunt.

Sample setup A: open to search, closed to training

For a business that wants to be recommended but not used for training:

User-agent: GPTBot
Disallow: /

User-agent: OAI-SearchBot
Allow: /

User-agent: ChatGPT-User
Allow: /

You'd extend the same idea to other vendors by reading their documentation for which agent is the training crawler and which is the search or user-triggered one.

Sample setup B: open everywhere except private paths

For a site that wants maximum visibility and has areas that shouldn't be fetched:

User-agent: *
Disallow: /account/
Disallow: /checkout/
Disallow: /internal/

That leaves every AI crawler free to read your public pages and keeps them out of private ones. It's also the lowest-maintenance option, because a new bot is covered automatically.

Sample setup C: closed

A site that blocks everything:

User-agent: *
Disallow: /

This is right for staging servers and wrong for production. A surprising number of live sites ship this line because a staging configuration was copied across. If your brand is absent from AI answers and you've never looked at this file, look now.

Where robots.txt isn't enough

The file states intent, but other layers decide what happens.

CDN and firewall rules. Bot management can answer an AI crawler with a 403 or a challenge page whatever robots.txt says. If your file allows OAI-SearchBot and your firewall blocks it, you're blocked.

Rendering. Many crawlers don't run JavaScript the way a browser does. If the content that answers a question only appears after client-side rendering, a crawler may see an empty shell.

Authentication walls and cookie banners. A full-page overlay in the HTML can hide content from a fetcher.

Rate limits. A 429 under load looks like absence.

How to test

Do it in three passes.

  1. Read the file as the bot would. Fetch yourdomain.com/robots.txt and, for each AI agent you care about, work out which group applies. Write the result down: allowed or blocked for your top pages.
  2. Check the network layer. Ask whoever runs your CDN whether bot protection treats these agents differently, and look for rules by country or ASN.
  3. Look at real requests. Pull recent logs and filter by agent. You want to see 200 responses on your commercial pages. Remember that user agents can be spoofed, so verifying against published IP ranges matters for anything you're going to act on.

Pass three is the one people skip, and it's the only one that proves the rest. VisibilyRanking's crawler log view connects to your CDN or host and lists requests from AI bots page by page, including errors and blocked paths. Promptwatch provides IP-verified crawler logs too, via its Agent Analytics, from the Professional plan upward.

Keeping it maintainable

Comment your rules with the date and the reason. Keep the file in version control. Review it whenever your CDN configuration changes, because that's when allowed bots tend to get blocked. And schedule a quarterly look at vendors' documentation: names change, and new agents appear.

A small habit helps more than a perfect file. Every time you launch a section of the site you want recommended, check that crawlers got a 200 on it within a week or two. If they didn't, you've found the problem before it cost you months.

What robots.txt can't do

It can't make an engine cite you. It only removes one reason it can't. After access is sorted, the work shifts to content: direct answers, clear definitions, and pages that deserve to be the source. Answers also vary by engine, prompt, location, and day, so measure over weeks rather than one run.

If you'd like to see which of your pages AI crawlers fetched last month and which they couldn't, we'll walk through it on your domain.

Book a VisibilyRanking demo