A Robots.txt & AI Crawler Builder generates standards-compliant RFC 9309 crawl directives that independently govern traditional search engines (Googlebot, Bingbot), ad-verification crawlers (Mediapartners-Google), AI search citation bots (OAI-SearchBot, PerplexityBot), and foundation-model training scrapers (GPTBot, ClaudeBot, Google-Extended, CCBot), while validating exact longest-prefix Allow/Disallow match precedence against any URL path.
How to Use Robots.txt & AI Bot Builder
- 1Pick an AI Crawler Governance Preset or Customize Individual Bots
Start with 'Allow AI Search, Block Training' (recommended for most publishers), 'Allow All' for maximum AI citation reach, or 'Block All AI' for strict training exclusion.
- 2Configure Domain, Sitemap URLs, and Private Disallow Prefixes
Enter your canonical site URL, sitemap.xml paths, and private paths such as /api/, /admin/, or /dashboard/ while keeping Mediapartners-Google allowed for AdSense.
- 3Validate Critical URLs in the Live Path Tester and Download
Test URLs like /, /blog/my-post, and /api/auth across Googlebot, OAI-SearchBot, and GPTBot to confirm exact RFC 9309 evaluation, then copy or download robots.txt to your web root.
Core Capabilities & Specifications
- 3 battle-tested presets: Allow AI Search / Block Training, Allow All (Max AIEO), and Block All AI Bots
- Explicit Mediapartners-Google toggle so AdSense verification is never accidentally blocked
- Granular Allow/Disallow controls for GPTBot, OAI-SearchBot, ClaudeBot, PerplexityBot, Google-Extended, CCBot & Bytespider
- Live RFC 9309 URL Path Tester simulating longest-prefix precedence per User-agent
- Auto-generates Host, Sitemap URLs, custom Disallow paths & downloadable robots.txt
Separating AI Search Citation Bots from Model Training Scrapers
Publishers no longer face an all-or-nothing choice with AI crawlers. Major AI providers now publish distinct User-Agent tokens for real-time search/retrieval citations versus offline foundation-model pretraining. For example, OpenAI distinguishes OAI-SearchBot (powers ChatGPT Search links and referral traffic) from GPTBot (model training), while Google distinguishes Googlebot (Google Search ranking) from Google-Extended (Gemini/Vertex training opt-out).
Blocking GPTBot and Google-Extended while explicitly allowing Googlebot, Bingbot, OAI-SearchBot, and PerplexityBot lets publishers capture high-intent referral clicks from AI answer engines without granting blanket pretraining rights—provided your robots.txt groups are ordered and formatted according to RFC 9309.
- Blocking Google-Extended does NOT affect your Google Search rankings or Googlebot indexing.
- Blocking OAI-SearchBot removes your domain from ChatGPT Search citations and link cards.
- Always verify Mediapartners-Google has Allow: / if you run Google AdSense—blocking it causes ad-serving drops and review rejections.
User-agent: *
Allow: /
Disallow: /api/
Disallow: /admin/
# Protect Google AdSense crawler access
User-agent: Mediapartners-Google
Allow: /
# Allow AI search citation & referral crawlers
User-agent: OAI-SearchBot
Allow: /
User-agent: PerplexityBot
Allow: /
# Opt out of bulk pretraining scrapers
User-agent: GPTBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: CCBot
Disallow: /
Sitemap: https://example.com/sitemap.xmlHow RFC 9309 Longest-Prefix Rule Precedence Actually Works
Many SEO regressions happen because teams assume robots.txt rules are evaluated top-to-bottom like firewall ACLs. Under RFC 9309 (the Robots Exclusion Protocol standard ratified by the IETF and implemented by Googlebot), a crawler first picks the most specific matching User-agent group (falling back to User-agent: * only if no specific group matches). Note that specific User-agent groups do NOT inherit rules from User-agent: *!
Inside the matched group, the crawler compares all matching Allow and Disallow path prefixes and applies the LONGEST matching rule. If an Allow and Disallow rule match with identical path length, RFC 9309 breaks ties in favor of Allow (the less restrictive directive).
- Specific User-agent blocks override User-agent: * completely—repeat /api/ Disallows inside specific blocks if needed.
- Longest matching path prefix wins, regardless of line order inside the group.
- Robots.txt controls CRAWLING, not INDEXING: a disallowed URL linked from external sites can still appear in Google without a snippet. Use meta robots noindex (on a crawlable page) to de-index.
Preventing Crawl Budget Waste and Accidental Asset Blocking
Never disallow /_next/static/, /assets/, CSS stylesheets, or JavaScript bundles needed to render your page. Googlebot renders modern web apps with evergreen Chromium; blocking static JS/CSS causes broken mobile-usability signals, incomplete DOM rendering, and AdSense layout verification failures.
Instead, focus Disallow rules on infinite faceted-search parameter URLs, authenticated user dashboards, internal search results pages, and backend /api/ JSON endpoints, while advertising every canonical XML sitemap at the bottom of robots.txt with full HTTPS URLs.
import type { MetadataRoute } from "next";
export default function robots(): MetadataRoute.Robots {
return {
rules: [
{ userAgent: "*", allow: "/", disallow: ["/api/", "/admin/"] },
{ userAgent: "Mediapartners-Google", allow: "/" },
{ userAgent: "OAI-SearchBot", allow: "/" },
{ userAgent: "PerplexityBot", allow: "/" },
{ userAgent: ["GPTBot", "Google-Extended", "CCBot"], disallow: "/" },
],
sitemap: "https://example.com/sitemap.xml",
};
}Engineering Comparison Matrix
| Bot User-Agent | Operator | Primary Role | Blocks Search Ranking? |
|---|---|---|---|
| Googlebot | Google Search indexing & ranking | Yes (Never block root) | |
| Mediapartners-Google | Google AdSense | Ad contextual analysis & policy review | No, but breaks AdSense |
| OAI-SearchBot | OpenAI | ChatGPT Search citations & referral links | No (Affects ChatGPT links) |
| GPTBot | OpenAI | Foundation model pretraining dataset | No |
| Google-Extended | Gemini / Vertex AI training control token | No (Independent of Googlebot) | |
| PerplexityBot | Perplexity | AI answer citations & live search retrieval | No (Affects Perplexity links) |
| ClaudeBot | Anthropic | Anthropic web crawling & data collection | No |
| CCBot | Common Crawl | Open web archive used by many LLM datasets | No |
Common Production Pitfalls to Avoid
- •Assuming a specific User-agent block inherits Disallow: /admin/ from User-agent: * (under RFC 9309, it does NOT).
- •Using robots.txt Disallow to try to remove an already-indexed page from Google instead of returning an X-Robots-Tag: noindex header.
- •Blocking /_next/static/ or CSS/JS files, preventing Googlebot and AdSense from rendering the layout.
- •Returning HTTP 5xx errors on /robots.txt—Google interprets persistent 5xx errors as a full-site crawl halt.
Frequently Asked Questions
Does blocking GPTBot or Google-Extended hurt my Google SEO rankings?
No. Google officially documents that Google-Extended is a standalone control token for AI training and grounding that does not affect Googlebot or Google Search ranking. Similarly, GPTBot has no effect on Google or Bing organic search.
What is the difference between GPTBot and OAI-SearchBot?
OpenAI uses OAI-SearchBot to index pages for ChatGPT Search citations and outbound publisher referral links, whereas GPTBot crawls content for model training. Many publishers allow OAI-SearchBot for free referral traffic while blocking GPTBot.
Why should I include Mediapartners-Google in robots.txt if I use AdSense?
Mediapartners-Google is Google AdSense's dedicated crawler that inspects page content for policy compliance and contextual ad matching. Explicitly allowing it guarantees that strict wildcard or scraper rules never interrupt ad serving or site approval.
Where must robots.txt be hosted and what status code must it return?
It must be served at the exact root path of each protocol and subdomain (for example, https://example.com/robots.txt and https://sub.example.com/robots.txt) with Content-Type: text/plain and HTTP 200 OK.
Does robots.txt enforce security or stop malicious scrapers?
No. Robots.txt is a voluntary compliance protocol honored by legitimate search engines and major AI labs. Never list secret admin endpoints in robots.txt as a security measure—protect private routes with authentication, RBAC, and WAF rules.