Web Crawlers, Robots.txt, AI Scraper Directives & Search Indexing Architecture Runbook
Architectural runbook on the Robots Exclusion Protocol (RFC 9309). Master crawler precedence algorithms, AI scraping fleet governance, crawl budget preservation, and the defense-in-depth hierarchy between robots.txt, meta robots, and X-Robots-Tag HTTP response headers.
1. RFC 9309 Protocol Specifications: Crawler Discovery & Precedence Mechanics
curl -sI -A "Googlebot/2.1 (+http://www.google.com/bot.html)" https://example.com/robots.txt \
&& curl -s https://example.com/robots.txt | head -n 30Validates that robots.txt returns an unambiguous HTTP 200 OK with text/plain Content-Type and no caching or redirect loops.
# Example matching order against URI: /photos/nature/mountain.jpg
# Rule 1: Disallow: /photos/
# Rule 2: Allow: /photos/nature/
# Result: ALLOWED (Length 15 > Length 8)Demonstrates that the longer string pattern takes absolute precedence regardless of which line appears first in the file.
| Pattern Directive | Matching Behavior | RFC 9309 Standard Status | Copy |
|---|---|---|---|
| Disallow: /admin | Blocks /admin, /admin/, /admin.html, and /admin/users (prefix match) | Standard Prefix | |
| Disallow: /admin/ | Blocks /admin/ and /admin/subpaths, but permits /admin.html | Directory Boundary | |
| Disallow: /*.pdf$ | Matches all URIs ending exactly with the .pdf extension using end-anchor ($) | Extension Match | |
| Allow: /public/ | Carves out access exceptions inside broader parent Disallow scopes | Exception Rule |
2. AI Web Scrapers & LLM Crawling: Taxonomy, Tokens & Defensive Disallows
# Block Model Training Bots while permitting Search & Retrieval
User-agent: GPTBot
User-agent: ChatGPT-User
User-agent: ClaudeBot
User-agent: Claude-Web
User-agent: CCBot
User-agent: Bytespider
User-agent: PerplexityBot
User-agent: Diffbot
User-agent: Applebot-Extended
Disallow: /Explicitly excludes training crawlers from ingesting platform assets while leaving standard search engine indexers unaffected.
map $http_user_agent $is_ai_bot {
default 0;
~*(GPTBot|CCBot|Bytespider|ClaudeBot|PerplexityBot) 1;
}
limit_req_zone $binary_remote_addr zone=ai_limit:10m rate=1r/s;Network-level rate-limiting preventing rogue AI scrapers that ignore RFC 9309 from overwhelming origin database pools.
| Bot Token / User-Agent | Operator Organization | Crawler Primary Purpose | Copy |
|---|---|---|---|
| GPTBot | OpenAI (Training & Model Dataset Harvester) | LLM Training | |
| ChatGPT-User | OpenAI (Direct Real-time User Browsing Action) | Live Retrieval | |
| ClaudeBot | Anthropic (Training & Retrieval Harvester) | LLM Training | |
| CCBot | Common Crawl (Public Dataset Scraper used by AI Labs) | Bulk Scraping | |
| Bytespider | ByteDance / TikTok (LLM Training & Data Aggregation) | High-Velocity Bot | |
| PerplexityBot | Perplexity AI (Search Indexer & Live Retrieval) | AI Search |
3. robots.txt vs <meta name="robots"> vs X-Robots-Tag: The Hierarchy
# Block indexing of PDF manuals, CAD files, and internal JSON endpoints
location ~* \.(pdf|doc|docx|json)$ {
add_header X-Robots-Tag "noindex, nofollow, noarchive" always;
}Prevents non-HTML documents from appearing in search results where HTML meta tags cannot be rendered.
<head>
<!-- Prevent indexing and pass zero link equity -->
<meta name="robots" content="noindex, nofollow, noarchive, max-image-preview:none" />
</head>Standard document-level directive instructing search bots to index nothing and discard cached snippet previews.
| Directive Mechanism | Enforcement Layer | Best Applied Scenario | Copy |
|---|---|---|---|
| robots.txt | Server root text file (`/robots.txt`) | Crawl Budget Preservation | |
| <meta name="robots"> | HTML `<head>` DOM node | Page-Level Indexing Rules | |
| X-Robots-Tag | HTTP 1.1 / HTTP/2 Response Header | PDFs, Images & REST APIs | |
| Canonical Link Tag | `<link rel="canonical" href="...">` | Duplicate Parameter Merging |
4. Crawl Budget Engineering, Faceted Navigation & Infinite Trap Mitigation
# Block faceted sorting and pagination sprawl while allowing canonical URLs
User-agent: *
Disallow: /*?*sort=
Disallow: /*?*filter=
Disallow: /*?*page=*
Disallow: /search?
Disallow: /calendar/*Eliminates crawler loops by pruning search and filter URL parameters before requests hit the origin application server.
rg "Googlebot" /var/log/nginx/access.log \
| awk '{print $7}' \
| sort \
| uniq -c \
| sort -rn \
| head -n 25Audits top requested URIs by search bots to detect runaway parameter combinations consuming server resources.
| Crawler Trap Pattern | Root Cause Mechanism | Recommended Engineering Solution | Copy |
|---|---|---|---|
| Faceted Filters (?sort=) | Combinatorial explosion of sorting and multi-select filters | robots.txt Disallow + Canonical | |
| Infinite Date Calendars | Links generating forward and backward years indefinitely | noindex on past/future + robots.txt | |
| Session Identifiers (?sid=) | Unique query parameter appended to every visitor session | Cookie Migration + Clean URLs | |
| Internal Search Results | Spam injection creating low-quality search engine pages | Disallow: /search? + noindex |
5. HTTP Status Codes & Error Edge Cases for Search Bots (404 vs 410 vs 429 vs 503)
# Signal temporary maintenance so bots return without dropping indexed URLs
error_page 503 @maintenance;
location @maintenance {
add_header Retry-After "3600" always; # Retry in 1 hour
return 503 "Service temporarily unavailable. Please retry shortly.";
}Guarantees search bots pause crawling without de-indexing pages during scheduled maintenance or database migrations.
# Instruct crawlers to immediately remove defunct legacy URLs from index
location ~* ^/(legacy-v1|outdated-promo|deleted-catalog)/ {
return 410 "Content permanently removed.";
}Accelerates index purging compared to 404 Not Found, which search engines retry repeatedly for several weeks.
| HTTP Status Code | Crawler Interpretation | Indexation Impact & Best Practice | Copy |
|---|---|---|---|
| 404 Not Found | Resource missing; bot retries repeatedly over days/weeks | Gradual De-indexing | |
| 410 Gone | Resource permanently deleted; fast index purge | Immediate De-indexing | |
| 429 Too Many Requests | Origin overloaded; crawler drastically slows request rate | Crawl Rate Throttling | |
| 503 Service Unavailable | Temporary outage; requires Retry-After header | Preserves All Index Rankings | |
| 301 Moved Permanently | Canonical redirection; transfers ~99% link equity | Permanent URL Migration |
Related Free Online Tools
Put these techniques into practice immediately with our privacy-first browser utilities:
Generate verified RFC 9309 robots.txt files, AI crawler shields, and meta robots tags.
Construct Open Graph, Twitter Cards, and canonical search metadata headers.
Inspect X-Robots-Tag response headers and audit RFC 9110 status codes for crawlers.