Skip to content

robots.txt

robots.txt is a plain-text file at the root of a domain that tells crawlers which URLs they may or may not fetch, via a user-agent and Disallow/Allow rules; it is advisory, not enforcement.

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

  1. 1994 — Martijn Koster proposes robots.txt on the www-talk mailing list.

  2. 1996 — The Robots Exclusion Protocol is widely adopted by search engines.

  3. 2019 — Google publishes guidance clarifying how it handles Allow and crawl-delay.

  4. 2020 — Google open-sources its robots.txt parser (in C++).

  5. 2022 — RFC 9309 formalizes the Robots Exclusion Protocol for the first time.

Writing robots.txt that works

robots.txt that protects without hiding

  1. Default to allow

    User-agent: * followed by Allow: / is the safe default. Then add Disallow: for specific paths.

  2. One sitemap per line

    Sitemap: can be repeated. List every sitemap and sitemap-index.

  3. Block only admin and search

    /admin/, /search/, /*?s= are the safe blocks. Blocking the whole / is never right.

  4. Test with Search Console

    The "robots.txt tester" in Search Console validates the syntax and simulates a fetch. Use it before every deploy.

  5. Never block the sitemap

    A Disallow: /sitemap.xml blocks 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
1994 · propuesta de Martijn Koster en www-talk
1996 · adopción amplia por buscadores
2020 · Google open-sourcea su parser de robots.txt
2022 · RFC 9309 formaliza el protocolo
1 · archivo por dominio, en la raíz

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

Etymology

Origin: compound

  • robots (noun): plural of robot, from Czech robota, "forced labor"; extended to automated crawlers in the 1990s
  • txt (suffix): plain-text file extension

Semantic network

robots.txtwebSEOCrawlerSitemapnoindexSEOrfc-9309

● broader ● narrower ● related

Broader

Related

Used in the garden

Sources