SEO / GEO

Robots.txt Guide: Search Bots, AI Bots and Agents

What robots.txt is and what it can and can't block. A guide to allowing Google, ChatGPT, Claude and Perplexity bots, blocking folders and handling agents.

· 9 min read

An office desk with a monitor showing highlighted lines in a code editor and a laptop displaying a crawl report

Robots.txt is a plain text file in your site’s root directory that tells bots which URLs they should and shouldn’t crawl. It’s not a lock, it’s a list of requests: bots that follow the rules comply, and it can’t stop the ones that don’t. In this post, I cover how the file works, how to allow or block AI bots, which folders should be closed off, and why robots.txt isn’t enough when it comes to agents.

What does robots.txt do?

Before a bot crawls your site, it checks https://yourdomain.com/robots.txt. If the file has a rule for it, it behaves accordingly. Robots.txt has three core jobs:

  1. Managing crawl budget: Keeping bots from spending their time on useless pages (filter combinations, internal search results, the cart).
  2. Separating bots: Setting different rules per bot, such as allowing a search bot while blocking a training bot.
  3. Pointing to the sitemap: Telling bots where your sitemap is with a Sitemap: line.

The file only applies to one domain and protocol. The www and non-www versions, as well as every subdomain, each need their own robots.txt file.

How do you write the file?

Each rule group starts with a User-agent line, followed by Disallow (block) and Allow (permit) lines.

# General rule for all bots
User-agent: *
Disallow: /cart/
Disallow: /account/
Allow: /

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

A few rules you should know:

  • Your sitemap doesn’t have to be called sitemap.xml. What matters is that the Sitemap: line points to a file that actually exists. Many platforms generate an index file such as sitemap-index.xml instead of a single file; it lists the actual sitemaps. On large sites this is required, because a single sitemap can hold at most 50,000 URLs.
  • Paths are case-sensitive. /Cart/ and /cart/ are different URLs.
  • The most specific rule wins. When an Allow and a Disallow both match the same URL, Google picks the longer (more specific) path.
  • If a bot finds a group under its own name, it only follows that group. The rules under User-agent: * no longer apply to that bot. This is one of the most common mistakes.
  • The * and $ wildcards are supported by Google and most major bots: Disallow: /*?sort= blocks URLs with a sort parameter, and Disallow: /*.pdf$ blocks PDF files.
  • crawl-delay doesn’t work in Google. Google ignores this line. Some other bots may honor it, but don’t rely on it.
  • File size is limited. Google reads the first 500 KiB of the file and ignores the rest. If your robots.txt runs to thousands of lines, you’ll need to consolidate rules.

It’s also worth knowing what happens when the file can’t be reached. Google treats all 4xx errors except 429 as if no valid robots.txt file exists, which means it assumes there are no crawl restrictions. With 5xx errors, Google pauses crawling for a while. So a robots.txt that responds properly on the server matters as much as the rules inside it.

Is Disallow the same as noindex?

No, and this difference gets mixed up a lot in practice. Disallow blocks crawling, not indexing. If other sites link to a page you’ve blocked, Google can still index that URL without ever seeing its content.

If you don’t want a page to appear in search results, add a noindex tag to the page and leave crawling open. As Google also states, the noindex rule is the most effective way to remove URLs from the index when crawling is allowed. Google can never see a noindex tag on a page you’ve blocked with robots.txt.

AI bots: which one does what?

AI companies no longer use a single bot; they run separate bots for different purposes. To make the right robots.txt decision, you need to know this distinction:

Company Training bot Search / index bot User-initiated bot
OpenAI GPTBot OAI-SearchBot ChatGPT-User
Anthropic ClaudeBot Claude-SearchBot Claude-User
Perplexity (doesn’t train models) PerplexityBot Perplexity-User
Google Google-Extended (separate token for Gemini use) Googlebot
Apple Applebot-Extended Applebot

This distinction matters because blocking each one has a different outcome:

  • Blocking a training bot asks that your content stay out of future model training. Anthropic says that when a site restricts ClaudeBot access, it signals that the site’s future content should be excluded from AI training datasets.
  • Blocking a search bot lowers your visibility in AI answers. According to OpenAI’s documentation, sites that block OAI-SearchBot won’t be shown in ChatGPT search answers.
  • Blocking a user-initiated bot doesn’t always work. OpenAI writes that because ChatGPT-User actions are initiated by a user, robots.txt rules may not apply. Perplexity says the same: since the request comes from a user, this bot generally ignores robots.txt rules. Anthropic, on the other hand, states that all three of its bots respect robots.txt.

So if you want a split like “no to training, yes to search,” write the rule for the training and search bots, not the user-initiated bot.

Should I allow AI bots?

It’s a business decision. Here’s how I see it: if your site gains traffic and visibility through content (a blog, e-commerce category and product pages), blocking search bots means cutting yourself out of a new discovery channel. For training bots, the decision depends more on the value of your content and your company’s policy.

Three common scenarios:

Allow all (this site’s choice):

# Allowed AI bots: GPTBot, OAI-SearchBot, ChatGPT-User,
# ClaudeBot, Claude-SearchBot, Claude-User, PerplexityBot, Perplexity-User,
# Google-Extended, Applebot-Extended
User-agent: *
Allow: /

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

If you’re giving every bot the same access, a single User-agent: * group is enough, and it’s the safest approach. If you want to make visible which bots you allow, do it with a comment line, not by opening a new rule group.

No to training, yes to search:

User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: Applebot-Extended
Disallow: /

User-agent: *
Allow: /

Block all: Disallow: / for every bot. Keep in mind that user-initiated bots won’t always respect this.

Which folders should be blocked, and which never?

The rule is simple: block URLs that waste the bot’s time or have no use in search results, and never block anything a page needs in order to render.

Can be blocked Why Should not be blocked Why
Internal search results (/search?q=) Generates an endless number of low-value URLs CSS and JS files Google renders the page with them
Cart, checkout, account User-specific, no search value Product and category images Image search and product listings
Sort/filter parameter combinations Thousands of copies of the same content Product, category and blog pages This is where the real traffic comes from
Test/staging environment (with its own robots.txt if on a separate domain) Duplicate content Sitemap So bots can find your pages

A typical e-commerce example:

User-agent: *
Disallow: /cart/
Disallow: /checkout/
Disallow: /account/
Disallow: /search
Disallow: /*?sort=
Disallow: /*&sort=
Allow: /

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

Is robots.txt enough for agents?

No. Two things need to be separated here. Crawlers collect pages, index them and check robots.txt. Agents, on the other hand, browse your site on a user’s behalf with a real browser, clicking buttons and filling in forms. Even Anthropic covers crawlers in its own support page under a separate heading from browsers that navigate on a user’s behalf.

If you don’t want an agent taking actions on your site (adding to cart, submitting forms, creating accounts), you control that not with robots.txt but with:

  • Requiring login for anything that involves an action.
  • Bot protection on forms: Verification steps like CAPTCHA or Cloudflare Turnstile.
  • Server-side rate limits and WAF rules: Stopping sessions that make a large number of requests in a short time.
  • Not exposing an actionable endpoint at all: On a static site with no forms, logins or APIs, like this one, the only thing an agent can do is read.

In short, robots.txt answers the question “what can you read,” not “what can you do.”

Checklist

  • The file opens at https://yourdomain.com/robots.txt with a 200 status code
  • Every subdomain has its own robots.txt file
  • CSS, JS and images aren’t blocked
  • Cart, account, internal search and parameter combinations are blocked
  • Pages that need to be removed from the index use noindex, not Disallow
  • AI bot decisions are made based on the training / search / user-initiated split
  • Private areas aren’t listed in robots.txt and are password-protected
  • The Sitemap: line points to the correct URL
  • The robots.txt report in Search Console checked after changes

Summary

  • Robots.txt is a list of requests: bots that follow it comply, but it doesn’t provide security.
  • Disallow blocks crawling, not indexing. Use noindex to remove pages from the index.
  • Separate AI bots into training, search and user-initiated bots; blocking each one has a different outcome.
  • User-initiated bots and agents don’t always respect robots.txt. Protect actions with login, bot protection and server rules.
  • CSS, JS, images and core content pages should never be blocked.

[INTERNAL LINK: sitemaps and indexing]

Sources

  • robots.txt
  • technical seo
  • geo
  • gptbot
  • claudebot
  • ai bots

Related posts

Marketing News

AI Visibility: Share of Voice vs. Sentiment in Apparel

An itibar.ai study measured how ChatGPT, Gemini and Claude talk about 11 apparel brands in Turkey. Why isn't the most mentioned brand the best regarded?

· 3 min read

XML Feed

Give Your Zero-Impression Products a Chance in Ads

A step-by-step guide to finding catalog products with zero impressions and moving them into a separate PMax and Meta campaign using a custom label.

· 9 min read