Sub topic 3
robots.txt: the standard everything else is compared to
Assume that you know how a website is served over HTTP and can read a simple access log. This chapter uses “crawler” for a program that requests web pages and “user-agent token” for the name a crawler sends to identify itself.
What robots.txt does
robots.txt is a plain-text file at the root of a web origin:
https://example.com/robots.txtIt uses the Robots Exclusion Protocol (REP). A site owner publishes rules, and a compliant crawler checks those rules before requesting URLs.
A rule group starts with User-agent. Disallow lists paths the matching crawler should not fetch. An empty Disallow means that no paths are blocked.
User-agent: GPTBot
Disallow: /
User-agent: OAI-SearchBot
Allow: /
User-agent: Google-Extended
Disallow: /
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xmlThis example asks GPTBot and Google-Extended not to fetch the site. It allows OAI-SearchBot. The wildcard group allows other crawlers unless they have a more specific group.
The exact meaning of an AI token depends on its publisher. For example, a company might use separate tokens for model training, search indexing, and fetching content after a user asks an assistant a question. A rule for one token does not automatically control the company's other tokens.
Advisory rules, not a lock
robots.txt is an advisory convention. It communicates the site's preference to crawlers that choose to comply. It does not authenticate requests, encrypt pages, or prevent a crawler from ignoring the file.
The distinction matters:
| Mechanism | Main purpose | Stops an uncooperative client? |
|---|---|---|
| `robots.txt` | Tell compliant crawlers which URLs to fetch | No |
| Authentication | Require an identity or credential | Yes, when configured correctly |
| WAF or rate limit | Filter and control requests | Usually, but not perfectly |
Never place secrets in a disallowed path. A crawler can still request that path, and the file itself publicly reveals the path.
How crawlers apply rules
A crawler normally:
- Fetches
/robots.txtfor the relevant host and protocol. - Finds the group matching its user-agent token.
- Compares the requested path with that group's rules.
- Fetches the page only when the path is allowed.
Rules are scoped to a host. https://example.com/robots.txt does not control https://cdn.example.com/robots.txt. HTTP and HTTPS are also separate origins in practice, so serve suitable rules for each one.
Allow and wildcard matching have implementation details that differ between consumers. Features such as * and $ are widely supported but are not equally guaranteed by every crawler. Keep important policies simple, test them with the crawler's documented behavior, and inspect logs afterward.
AI-specific choices
Do not assume that one “AI crawler” token represents every use. Before adding a rule, identify:
- Which company publishes the token.
- Whether it represents training, search, or user-triggered retrieval.
- Whether blocking it also affects an important search product.
- Whether the company documents the token and honors REP.
A broad wildcard rule is easy to maintain but may block useful indexing. A token-specific rule gives more control, but it depends on honest identification and accurate vendor documentation.
Exercise
Does Disallow: /private/ protect files under /private/ from every client?
Show answer
No. It asks compliant crawlers not to fetch matching paths. Use authentication or another server-side control for protection.