Definition
What it is
The syntax is minimal:
User-agent: *
Disallow: /admin/
Disallow: /private/
Sitemap: https://example.com/sitemap.xml
User-agent sets the scope. * matches all crawlers. Googlebot matches Google only. Disallow: /admin/ blocks the path; Allow: /admin/public/ re-opens a subtree. Sitemap: is a hint, not a rule. Empty Disallow: allows everything.
robots.txt is advisory. A crawler that ignores it can still fetch any URL. Major search engines honor it; scrapers often do not. It is not a security control, it is a politeness convention.
Why it matters
A crawler that discovers /admin/ will keep trying to fetch it forever, spending crawl budget on 404s and 403s. robots.txt saves that budget. It also protects sensitive paths from casual scraping (not from determined scraping, for which you need authentication). And its Sitemap: directive is the fastest way to tell crawlers where the sitemaps live.
robots.txt vs noindex vs authentication
Aspect | robots.txt | noindex | Authentication |
|---|---|---|---|
Type | Advisory file | HTTP header or meta | Server check |
Blocks | Fetching | Indexing | Access |
Crawler honors | Usually | Usually | Always |
SEO effect | Page invisible to crawler | Page crawled but not indexed | Page invisible |
For admin panels | Yes | No | Yes |
Where robots.txt lives
graph LR
C[Crawler] --> R[Fetch /robots.txt]
R --> P{Parse rules}
P --> A[Apply per user-agent]
A --> G{URL allowed?}
G -->|Yes| F[Fetch URL]
G -->|No| S[Skip URL]
F --> X[Check Sitemap:]
style R fill:#E8F5E9
style S fill:#FFF3E0
Common failures
Timeline
1994 — Martijn Koster proposes robots.txt on the www-talk mailing list.
1996 — The Robots Exclusion Protocol is widely adopted by search engines.
2019 — Google publishes guidance clarifying how it handles
Allowand crawl-delay.2020 — Google open-sources its robots.txt parser (in C++).
2022 — RFC 9309 formalizes the Robots Exclusion Protocol for the first time.
Writing robots.txt that works
robots.txt that protects without hiding
Default to allow
User-agent: *followed byAllow: /is the safe default. Then addDisallow:for specific paths.One sitemap per line
Sitemap:can be repeated. List every sitemap and sitemap-index.Block only admin and search
/admin/,/search/,/*?s=are the safe blocks. Blocking the whole/is never right.Test with Search Console
The "robots.txt tester" in Search Console validates the syntax and simulates a fetch. Use it before every deploy.
Never block the sitemap
A
Disallow: /sitemap.xmlblocks the sitemap itself. If a rule blocks sitemaps, the crawler cannot discover URLs.
Origin
In February 1994, Martijn Koster proposed a "robot exclusion standard" on the www-talk mailing list, in response to crawlers overwhelming small servers. The proposal was adopted informally: a file called /robots.txt that any crawler could read before crawling. The name is literal: a file for robots (the 1990s term for automated crawlers, then often called "spiders" or "robots"). The robots.txt convention survived 28 years of informal adoption before being formalized as RFC 9309 in 2022.
This document specifies a simple, general-purpose, extensible protocol that can be used by content providers to indicate which parts of their server should not be visited by robots.
— RFC 9309, *Robots Exclusion Protocol*, 2022
Evidence
FAQ
- Does robots.txt prevent indexing?
No, it prevents fetching. A page blocked by robots.txt can still appear in search results if other pages link to it; the snippet will be empty.
- Can robots.txt protect sensitive files?
No. Use authentication. Scrapers ignore robots.txt.
- robots.txt vs noindex?
robots.txt blocks fetching; noindex blocks indexing. For pages you want crawled but not indexed, use noindex, not robots.txt.
- Where does robots.txt live?
At the domain root:
https://example.com/robots.txt. Subdirectories are not consulted.
Connections
Koster, M. et al. (2022). RFC 9309. https://www.rfc-editor.org/rfc/rfc9309
Google Search Central (2024). Robots.txt introduction and guide. https://developers.google.com/search/docs/crawling-indexing/robots/intro
Google (2020). robotstxt. https://github.com/google/robotstxt
Etymology
Origin: compound
robots(noun): plural of robot, from Czech robota, "forced labor"; extended to automated crawlers in the 1990stxt(suffix): plain-text file extension
Semantic network
● broader ● narrower ● related
Used in the garden
- Technical SEO, Core Web Vitals, and Mobile SEO: The Complete Guide (12×)
- Technical SEO Audit: Uncover & Fix Hidden Ranking Leaks for Dominance (5×)
- Technical SEO: Speed, Core Web Vitals, and Crawl Optimization (4×)
- Technical SEO for consultants (3×)
- Recovery SEO: How to Recover Lost Traffic and Rankings (2×)
- The Unseen Battlefield: How Server Logs Uncover Your SEO Power (2×)
- The Ultimate SEO Guide: How to Dominate Search Engines (2×)
- SEO · ENDURE (1×)
- Unlocking Market Dominance: Build a Hyper-Niche Price Comparison Engine (1×)
- Puppeteer & Cheerio: Master Web Data for Micro-SaaS Dominance in LatAm (1×)
- Competitor SEO: Gap Analysis and Opportunity Identification (1×)
- E-commerce SEO: How to Optimize Your Online Store for Search and Sales (1×)
- 10 More Forbidden Websites: The Web's Darkest Secrets Exposed (1×)
Sources
Koster, M. et al. (2022). RFC 9309. https://www.rfc-editor.org/rfc/rfc9309
Google Search Central (2024). Robots.txt introduction and guide. https://developers.google.com/search/docs/crawling-indexing/robots/intro
Google (2020). robotstxt. https://github.com/google/robotstxt