Complete Guide to Robots.txt & The RFC 9309 Exclusion Protocol
A robots.txt file is a plain-text document located at the root of your web server that instructs automated web robots—such as Googlebot, Bingbot, and AI data scrapers—on which parts of your website they are permitted or restricted from crawling. First conceptualized in 1994 and formally standardized as IETF RFC 9309 in 2022, the Robots Exclusion Protocol is one of the most fundamental building blocks of modern technical Search Engine Optimization (SEO) and web server security.
⚡ Quick Usage Guide
1. Choose a 1-click platform preset (WordPress, Shopify, Laravel, or Block AI) or select custom crawler rules.
2. Specify disallowed directories (e.g. /admin/, /checkout/) and explicitly allowed public assets.
3. Verify your XML Sitemap absolute URL and audit individual paths with the Live Indexability Tester.
4. 1-click copy or download your validated robots.txt file and place it in your website root directory.
Core Robots.txt Directives Explained
A well-formed robots.txt file is organized into blocks of directives. Each block begins with a User-agent declaration specifying which crawler the following rules apply to:
User-agent: *: The universal wildcard target. Applies to all crawlers unless a more specificUser-agentblock matching that crawler's name exists.Disallow: [path]: Specifies a directory or URL prefix that the targeted crawler must not access. If left blank (Disallow:), it explicitly permits crawling of all paths.Allow: [path]: Explicitly permits crawlers to access a specific subfolder or file within an otherwise disallowed directory (for example, allowing/admin/public-preview/while disallowing/admin/).Sitemap: [URL]: Provides the absolute URL to your website's XML sitemap index, helping search engines discover newly published pages faster.Crawl-delay: [seconds]: Instructs compliant bots (such as Bingbot and Yandex) to pause for a designated number of seconds between consecutive requests. Note that Googlebot ignores Crawl-delay.
Rule Precedence: How Allow and Disallow Interact (RFC 9309)
Under the standardized RFC 9309 specification, crawler directives are evaluated by path specificity rather than the visual line order in the file:
- Longest Match Wins: The rule whose path pattern contains the greatest number of characters matching the requested URL is the rule that determines access. For instance, given
Disallow: /catalog/(9 chars) andAllow: /catalog/featured.html(23 chars), a crawler requesting/catalog/featured.htmlwill be permitted. - Allow Wins on Equal Length: If an
Allowdirective and aDisallowdirective match the exact same number of characters, theAllowdirective wins. - Wildcards (
*) and End-Anchors ($): The asterisk represents zero or more arbitrary characters, while the dollar sign anchors the pattern to the exact end of the URL path (e.g.,Disallow: /*.pdf$blocks all PDF files).
How to Block AI Scrapers and Protect Your Content
As generative artificial intelligence models proliferate, many website owners, publishers, and software platforms wish to allow search engine bots (like Googlebot and Bingbot) to index their pages for organic traffic, while simultaneously preventing AI companies from scraping their copyrighted content to train large language models. You can accomplish this by adding targeted disallow blocks for known AI bot user-agents:
GPTBot&ChatGPT-User: OpenAI web crawlers used for GPT-4 and ChatGPT web browsing.ClaudeBot&Anthropic-ai: Anthropic web scrapers used for Claude training datasets.CCBot: Common Crawl crawler, frequently utilized as foundational training data across AI labs.PerplexityBot: Perplexity AI conversational search engine crawler.
Our tool features a 1-click "🛡️ Block AI Scrapers" preset that injects verified disallow blocks for all prominent AI bots without touching your organic search crawlability.
Step-by-Step Server Configuration Guide
Your generated robots.txt file must always be publicly accessible at https://yourdomain.com/robots.txt with an HTTP 200 OK status and a Content-Type: text/plain header:
1. Apache Web Server
Place the robots.txt file directly in your public_html or www root folder. Ensure your .htaccess file does not rewrite or redirect requests to /robots.txt.
2. Nginx Web Server
Save robots.txt inside your site's root directory (e.g., /var/www/html/) and add the following block inside your Nginx server configuration:
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
3. Next.js 14+ App Router
In modern Next.js projects using the App Router, you can export a dynamic or static robots file by creating app/robots.ts or placing a static robots.txt directly inside the public/ directory.
Frequently Asked Questions (FAQ)
Where should the robots.txt file be uploaded on a web server?
The robots.txt file MUST be placed directly in the top-level root directory of your website domain or subdomain (e.g., https://example.com/robots.txt). Search engine crawlers look exclusively at the root URL. Placing robots.txt in a subdirectory like https://example.com/sub/robots.txt is invalid and will be completely ignored by Googlebot and all other standard crawlers.
Does Googlebot respect the Crawl-delay directive in robots.txt?
No. According to official Google Search Central documentation, Googlebot completely ignores the Crawl-delay directive. If your server is experiencing high crawl traffic from Google, you can adjust Google's crawl rate via Google Search Console settings. Other search engines like Bingbot, Yandex, and Baiduspider still recognize and respect Crawl-delay.
How do I block AI web scrapers like GPTBot, CCBot, and ClaudeBot?
To block AI scrapers from harvesting your website content for LLM training while still allowing Google and Bing to index your pages for organic search, declare individual User-agent blocks with 'Disallow: /'. For example: 'User-agent: GPTBot' followed by 'Disallow: /', and repeat for ClaudeBot, CCBot, and PerplexityBot. Our 1-click 'Block AI Scrapers' preset inserts these rules automatically.
What is the difference between Disallow: / and Disallow: in robots.txt?
'Disallow: /' (with a forward slash) instructs crawlers not to index ANY page or directory on the entire website, de-indexing your whole site. In contrast, 'Disallow:' (empty, with no slash) explicitly instructs crawlers that no directories are restricted, granting full access to crawl the entire website.
How do Allow and Disallow directives interact according to the RFC 9309 standard?
Under the official IETF RFC 9309 Robots Exclusion Protocol, directives are evaluated by specificity. The rule with the longest matching character length takes precedence. For example, if you declare 'Disallow: /admin/' and 'Allow: /admin/public-preview/', a crawler visiting '/admin/public-preview/' will follow the Allow rule because it is longer and more specific. If an Allow and Disallow rule have identical lengths, the Allow rule takes precedence.