Skip to content

Toufiq SEO

Technical SEO

Robots.txt Guide: What to Block, What Not to Block and Common Mistakes

What robots.txt can and cannot do, which URLs to block, how to handle AI crawlers and how to avoid site-wide mistakes.

  • Published
  • 4 min read
Small toy robot sitting on a laptop, representing search engine crawlers reading robots.txt
On this page
  1. What robots.txt does
  2. Crawling vs indexing: the most common misunderstanding
  3. Syntax rules that trip people up
  4. What to block and what not to block
  5. robots.txt and AI crawlers
  6. How to test robots.txt
  7. Frequently asked questions

Quick answer: robots.txt is a text file at the root of your domain that tells crawlers which URLs they may request. It controls crawling, not indexing: a URL blocked in robots.txt can still appear in Google if other pages link to it. To keep a page out of search results, allow crawling and use a noindex tag instead. Google does not support noindex or crawl-delay rules inside robots.txt.

robots.txt is a small file with a big blast radius. One wrong line can remove a whole site from Google. I have seen staging rules copied to production, a “Disallow: /” left after a redesign, and CSS and JavaScript folders blocked so Google could not render pages properly. This guide covers what the file does, what it does not do, and the rules I use.

What robots.txt does

Before crawling a site, well-behaved crawlers such as Googlebot request /robots.txt. The file lists rules by user agent. A simple example:

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

Sitemap: https://www.example.com/sitemap_index.xml

This tells all crawlers not to crawl the cart and internal search pages, allows everything else, and points to the sitemap.

Crawling vs indexing: the most common misunderstanding

GoalRight toolWrong tool
Keep a page out of search resultsnoindex meta tag or X-Robots-Tag headerrobots.txt Disallow
Stop crawlers wasting time on endless URLsrobots.txt Disallownoindex alone
Consolidate duplicatesCanonical tag or redirectrobots.txt Disallow
Protect private contentPassword protectionrobots.txt Disallow

The key point: Google cannot see a noindex tag on a page it is not allowed to crawl. If you block a page in robots.txt and add noindex, the noindex is never read. To remove a page from the index, allow crawling until Google has processed the noindex.

Syntax rules that trip people up

  • Location: the file must be at the root, such as https://www.example.com/robots.txt. Each subdomain and protocol needs its own file.
  • Paths are case-sensitive. /Admin/ and /admin/ are different.
  • Wildcards: Google supports * for any sequence of characters and $ for the end of a URL. Disallow: /*.pdf$ blocks PDF files.
  • Most specific rule wins. For Google, when Allow and Disallow conflict, the longer, more specific rule applies.
  • Size: Google reads up to 500 KiB of the file and ignores anything after that.
  • Unsupported rules: Google ignores noindex, nofollow and crawl-delay in robots.txt.

What to block and what not to block

Usually worth blocking:

  • Internal site search results.
  • Cart, checkout and account pages.
  • Faceted filter combinations that create near-infinite URLs. See my guide to faceted navigation SEO before doing this, because it depends on which filters have search demand.
  • Tracking or session parameters that create duplicate URLs.

Do not block:

  • CSS, JavaScript and image files needed to render your pages.
  • Pages you want removed from the index (use noindex instead).
  • Pages carrying canonical tags or redirects you need Google to see.

robots.txt and AI crawlers

Many site owners now use robots.txt to manage AI crawlers. Common user agents include GPTBot (OpenAI), ClaudeBot (Anthropic), PerplexityBot and CCBot (Common Crawl). Google offers a separate token, Google-Extended, which controls whether content is used for Gemini models and grounding. Google states that Google-Extended does not affect inclusion in Google Search and is not a ranking signal.

Blocking Googlebot itself would remove you from Search and from AI Overviews, which use the same index. Decide on AI crawlers deliberately: blocking them can protect content, but it also reduces the chance of being cited in AI assistants. My llms.txt guide covers the related question of AI-specific files.

How to test robots.txt

  1. Open the robots.txt report in Search Console to see the version Google fetched, when, and any errors.
  2. Use the URL Inspection tool on important URLs to confirm they are not blocked.
  3. Before deploying changes, test the new rules against a list of key URLs with a robots.txt testing library or crawler.
  4. After a site launch or migration, check robots.txt on the live domain first. Staging rules are a classic launch-day disaster.

Server errors matter too. If robots.txt returns a 5xx error, Google may slow or pause crawling of the site until it can read the file again.

robots.txt is one of the first things I check in a technical SEO audit. If you are unsure whether your rules are helping or hurting, my technical SEO service includes a full crawl and indexing review.

Frequently asked questions

Can robots.txt remove a page from Google?

No. It only stops crawling. Use a noindex tag, or the Removals tool in Search Console for urgent temporary removal.

Does every site need a robots.txt file?

No. Without one, crawlers assume everything is allowed. A simple file with a sitemap line is still good practice.

How quickly does Google see robots.txt changes?

Google generally caches robots.txt for up to 24 hours, so changes usually take effect within a day.

Does blocking Google-Extended remove me from AI Overviews?

No. AI Overviews are part of Google Search and use Googlebot. Google-Extended controls use of content for Gemini models and grounding outside Search.

Sources: Google Search Central: Introduction to robots.txt; How Google interprets the robots.txt specification; Overview of Google crawlers and fetchers.

Toufiq-ur Rahman Kobir
Written by

Independent SEO consultant

Top Rated on Upwork

Toufiq-ur Rahman Kobir is an independent SEO consultant with five years of agency and freelance experience, including SEO management for a Dallas agency where he led more than twenty webmasters, content managers and copywriters. He works on technical SEO, content strategy and AI search visibility for US and international businesses.

Experience
Five years, agency and freelance
Previously
SEO Manager, JP Marketing, Dallas
Focus
Technical SEO, content strategy, AI search
Status
Taking on a limited number of clients
Scroll to Top