SEO

10 Common robots.txt Rules Explained (with Examples)

A robots.txt file is the first file search engine bots look for when visiting your website. Master robots.txt syntax: understand User-agent, Disallow, Allow, Crawl-delay, and Sitemap directives with 10 real-world examples. Applying these recommended techniques ensures high visual quality, faster page load speeds, and reliable performance across modern desktop and mobile web browsers.

Awais 2 min readPublished
10 Common robots.txt Rules Explained (with Examples)

A robots.txt file is the first file search engine bots look for when visiting your website. It acts as a traffic control guide, instructing crawlers like Googlebot, Bingbot, and AI scrapers which parts of your website they are permitted to crawl and which directories they should avoid.

A single misplaced slash or wildcard in your robots.txt can accidentally de-index an entire website or waste your server's crawl budget. Here is how robots.txt rules work, along with 10 common real-world examples.

The core robots.txt directives

  • User-agent: Identifies the bot the rule applies to (* means all bots, Googlebot specifies Google).
  • Disallow: Specifies a path crawlers should not fetch (e.g., /admin/).
  • Allow: Explicitly allows access to a sub-path within an otherwise disallowed parent directory.
  • Sitemap: Provides the full absolute URL of your XML sitemap.
  • Crawl-delay: Requests a delay (in seconds) between requests (honored by Bing/Yandex, ignored by Google).
Generate a clean, tested file in seconds using our free Robots.txt Generator tool.

10 Common robots.txt rule examples

1. Allow all crawlers complete access

User-agent: *
Disallow:

Sitemap: https://example.com/sitemap.xml

2. Block all bots from entire site (Staging / Dev)

User-agent: *
Disallow: /

3. Block specific private directories (Admin / Cart / Checkout)

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

4. Block a specific file

User-agent: *
Disallow: /config/database.json

5. Allow one file inside a blocked folder

User-agent: *
Disallow: /assets/
Allow: /assets/logo.png

6. Block specific search query strings

User-agent: *
Disallow: /*?q=
Disallow: /*?search=

7. Block a specific file extension (e.g., PDFs)

User-agent: *
Disallow: /*.pdf$

8. Block specific AI scrapers (GPTBot, CCBot)

User-agent: GPTBot
Disallow: /

User-agent: CCBot
Disallow: /

9. Set rules specific to Googlebot only

User-agent: Googlebot
Disallow: /temporary-promo/

10. Complete standard production setup

User-agent: *
Disallow: /admin/
Disallow: /tmp/
Disallow: /private/

Sitemap: https://example.com/sitemap.xml

Frequently asked questions

Robots.txt must be placed in the top-level root directory of your domain (e.g., https://example.com/robots.txt). Search engine crawlers will not check subdirectories.

No. Robots.txt manages crawling, not indexing. If external links point to a disallowed URL, Google may still index the URL. To prevent indexing, use a <meta name="robots" content="noindex"> tag instead.

Use: User-agent: *\nDisallow: /admin/

Use ToolOrbit's free Robots.txt Generator to select crawlers, specify paths, attach your sitemap, and download a valid robots.txt file in seconds.


Tools mentioned

More reading

View all guides
GEO, AEO and AIO Explained: How to Get Cited in AI Search
SEO

GEO, AEO and AIO Explained: How to Get Cited in AI Search

Understand GEO, AEO, and AIO search optimization. Learn how AI engines discover, extract, and cite your content with our practical checklists and free tools.

5 min readPublished
How to Write SEO Meta Tags: Title, Description and Open Graph
SEO

How to Write SEO Meta Tags: Title, Description and Open Graph

Learn how to create effective title tags, meta descriptions, Open Graph and Twitter tags that improve search visibility and click-through rates.

2 min readPublished
How to Create robots.txt: Allow, Disallow and Sitemap Rules
SEO

How to Create robots.txt: Allow, Disallow and Sitemap Rules

Learn how to write a valid robots.txt file to control crawler access, protect private pages, and point search engines to your sitemap.

2 min readPublished
Keyword Density Checklist: Analyse and Improve Your SEO Copy
SEO

Keyword Density Checklist: Analyse and Improve Your SEO Copy

Understand how to measure keyword density, spot over-optimisation, and use phrase frequency to make content more readable and search-friendly.

2 min readPublished
UTM Parameters Explained: How to Track Campaigns in GA4
SEO

UTM Parameters Explained: How to Track Campaigns in GA4

What utm_source, utm_medium and utm_campaign actually mean, the naming conventions that keep reports clean, and the mistakes that ruin attribution.

2 min readPublished
Technical SEO Basics Every Site Needs in 2026
SEO

Technical SEO Basics Every Site Needs in 2026

Meta tags, structured data, robots.txt and sitemaps — the technical foundations that help search engines understand your site.

3 min readPublished
UTM Campaign Builder: Track Links With Confidence
SEO

UTM Campaign Builder: Track Links With Confidence

Build correctly encoded UTM tracking URLs for your campaigns with ToolOrbit's free UTM Campaign Builder, all in your browser.

2 min readPublished
How to Write Title Tags and Meta Descriptions That Get Clicks
SEO

How to Write Title Tags and Meta Descriptions That Get Clicks

How Google builds a search snippet, the length limits to respect, and how to write titles and descriptions that earn the click.

2 min readPublished