Free Tools
By Fadhil Abdulla

Robots.txt Guide: Rules, Common Mistakes and How to Block AI Crawlers

How robots.txt works, the syntax and matching rules Google uses, mistakes that de-index sites, and the user-agents for GPTBot, ClaudeBot, Google-Extended and other AI bots.

Editorial disclosure: Pyalm publishes and maintains the products and free tools discussed on this site. Regulatory statements are linked to primary sources where applicable. No independent professional review is claimed unless a reviewer is explicitly named.

robots.txt is a plain text file at the root of your site that tells crawlers which paths they shouldn't fetch. It's simple, powerful and — when it goes wrong — capable of quietly removing a whole site from Google.

The basics

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

User-agent: GPTBot
Disallow: /

Sitemap: https://www.example.com/sitemap.xml
  • User-agent — which crawler the group applies to (* = all).
  • Disallow — paths not to crawl. Disallow: (empty) allows everything; Disallow: / blocks everything.
  • Allow — exceptions inside a disallowed path.
  • Sitemap — the full URL of your sitemap.
  • matches any characters; $ anchors the end (/.pdf$).

How Google picks a rule

  1. It uses the most specific user-agent group that matches (e.g. Googlebot over *).
  2. Within that group, the longest matching path wins.
  3. If an Allow and a Disallow are equally long, Allow wins.

robots.txt is not a privacy tool

  • Blocked pages can still appear in search (as a bare URL) if other sites link to them.
  • Malicious bots ignore it — and it advertises your "hidden" paths.
  • To keep a page out of Google, allow crawling and add <meta name="robots" content="noindex">.
  • To protect content, use authentication.

AI crawlers

User-agent Operator Purpose
GPTBot OpenAI Model training
OAI-SearchBot OpenAI ChatGPT search results
ChatGPT-User OpenAI Browsing on a user's request
ClaudeBot Anthropic Model training
Claude-SearchBot Anthropic Claude search
Google-Extended Google Gemini / Vertex AI training (doesn't affect Search)
Applebot-Extended Apple AI training
PerplexityBot Perplexity Answer engine index
CCBot Common Crawl Open dataset used by many models

Blocking training bots keeps your content out of future models; blocking search/answer bots can reduce your visibility in AI-powered search. Many businesses block training crawlers but allow search ones. It's a business decision — there's no universally right answer.

Build and test yours

The free Robots.txt Generator & Tester lets you block common private areas, pick which AI crawlers to block, add custom rules and your sitemap — then test any URL against the rules for Googlebot or any AI bot, using Google's matching logic. You can also paste an existing robots.txt to test it.

Mistakes that hurt

  • Disallow: / left over from a staging site — the classic de-indexing disaster
  • Blocking CSS and JS files, so Google can't render your pages
  • Blocking pages you've also marked noindex (Google can't see the noindex)
  • Putting robots.txt anywhere except the root of each host

SEO and infrastructure, built in

Pyalm builds SEO-first websites for businesses in India and the UAE — technical SEO, structured data, sitemaps, correct DNS and email authentication, and fast hosting — so these checks pass from day one.

WHOIS Lookup | DNS Lookup | Sitemap Generator | Robots.txt Generator | SERP Preview | All free tools

Keep reading

More from Pyalm

Oct 16, 2026

How to Format and Validate JSON (and Fix the 6 Most Common Errors)

Why JSON breaks, how to read a validator's error message, and a quick routine for pretty-printing, minifying and fixing JSON from APIs, logs and config files.

Oct 16, 2026

How to Compare Two JSON Files (Without Drowning in Diff Noise)

Text diffs flag reordered keys and whitespace as changes. Here's how a structural JSON comparison works, and how to use it to review API changes, configs and migrations.

Oct 16, 2026

Regex Cheat Sheet with Real Examples (Emails, Phones, Dates, UAE TRN)

A practical regular expression cheat sheet — the syntax you actually use, plus tested patterns for emails, UAE and Indian phone numbers, dates and tax numbers.

Oct 16, 2026

URL Encoding Explained: %20, + and When to Encode

What percent-encoding is, why spaces become %20, the difference between encodeURI and encodeURIComponent, and how to avoid double-encoding bugs.

Oct 16, 2026

Unix Timestamps Explained: Epoch Time, Seconds vs Milliseconds and Time Zones

What epoch time is, why it's the standard way to store dates, how to tell seconds from milliseconds, and how to avoid the time-zone bugs it causes.

Oct 16, 2026

Minify vs Beautify: What Code Minification Does and When to Use It

How minifying JavaScript, CSS and HTML shrinks files, how much it really saves, and when to beautify minified code to debug it.

Try the free Robots.txt Generator & Tester

Pyalm builds SEO-first websites for businesses in India and the UAE — technical SEO, structured data, fast hosting and the right DNS and email setup from day one.

Open Robots.txt Generator & Tester See website development All free tools