What Is robots.txt and Where Does It Go?
robots.txt is a plain-text file at the very root of your domain — https://example.com/robots.txt — that tells well-behaved crawlers which parts of your site they may fetch. It is part of the Robots Exclusion Protocol, a convention every major search engine has honored since the 1990s. One file, one location: a robots.txt in a subfolder is ignored, and there can be only one per hostname (subdomains each get their own).
Crawlers typically check robots.txt before (and periodically during) a crawl. If the file blocks a path, the bot skips it. If the file does not exist, the crawler assumes everything is allowed — which is why a missing robots.txt is fine for simple sites, and a deliberate one is better for anything with admin areas, filters, or duplicate content.
How Crawlers Read It: User-Agent Groups
The file is a sequence of groups. Each group starts with one or more User-agent: lines and applies its rules to exactly those bots — and only the most specific matching group is used. That last part surprises people: if Googlebot matches both a * group and a Googlebot: group, it obeys only the Googlebot group and ignores the wildcard one entirely.
User-agent: * Disallow: /private/ User-agent: Googlebot Allow: /
In this example Googlebot may crawl everything — including /private/ — because its own group wins and contains no Disallow. When you generate groups here, double-check that each bot’s effective group says what you intend.
Allow, Disallow, and Wildcard Patterns
Rule values are path prefixes with two wildcards: * matches any sequence of characters and $ anchors the end of the URL. Common patterns:
Disallow: /admin/— blocks /admin/ and everything below it.Disallow: /*?sort=— blocks any URL whose query string contains sort= (faceted navigation).Disallow: /*.pdf$— blocks PDFs only (the $ stops the match at .pdf).Allow: /public/— re-permits a subfolder inside an otherwise disallowed tree; in Google’s implementation the more specific (longer) path wins.Disallow: /with an empty rule value means “allow everything” — the generator emitsAllow: /instead, which is clearer.
What NOT to Do: robots.txt Is Not a Security Tool
robots.txt is a request, published in public. Anyone can read it — which makes it, ironically, a map of where you keep the private stuff. Malicious crawlers ignore it completely, and URLs that are disallowed but linked from elsewhere can still appear in search results without a snippet. The rules that matter:
- Protect with authentication — logins, htaccess, or server rules; never with Disallow.
- Hide from the index, not the crawl — use a
noindexrobots meta tag, which requires the page to be crawlable (do not also block it in robots.txt). - Do not block CSS and JS — old advice said to save bandwidth; today blocking render-critical assets breaks Google’s rendering and hurts rankings.
Crawl-Delay: When to Throttle Crawlers
Crawl-delay: 10 asks a bot to wait 10 seconds between requests. Bingbot, Yandex, and DuckDuckBot honor it; Googlebot ignores it (Google manages rate in Search Console instead). Use it for small or cheap-hosting sites getting hammered by SEO tools, and keep values modest — a huge delay can push a patient bot to sample your site less often. Set it per group, since one size rarely fits all bots.
The Sitemap Directive
Sitemap: https://example.com/sitemap.xml is unrelated to the allow/disallow rules above it — it is a global line telling crawlers where your XML sitemap lives. Unlike User-agent rules, it is always processed, and you can list multiple sitemaps (and a sitemap index) on separate lines. Bing, Google, and others pick up new URLs faster from a declared sitemap than from link discovery alone, so this line is one of the highest-value things in the file.
Blocking AI Crawlers (GPTBot and Friends)
AI companies publish their own user agents — OpenAI’s GPTBot, Anthropic’s ClaudeBot, Common Crawl’s CCBot, and more. Blocking them is a normal robots.txt operation: create a group for the bot and Disallow: /. Many publishers allow AI bots on public marketing content but block them on premium or user-generated pages, using targeted Disallow paths rather than a blanket ban. Whichever stance you take, put it in writing in the file — silence means “crawl away”.
Step-by-Step: Using the Robots.txt Generator
- Keep “Allow all crawlers by default” on for typical public sites — it emits User-agent: * / Allow: /.
- Add a group per bot that needs different treatment. Pick a suggestion from the datalist or type any custom user agent.
- Add path rules and click the Allow/Disallow badge to flip a rule’s type. Use wildcards for query-string and file-type patterns.
- Set Crawl-delay only for bots that are actually over-crawling, and only where they honor it.
- Add your sitemap URL — the full absolute https:// address of sitemap.xml.
- Download robots.txt and upload it to your web root. Test it live at
yourdomain.com/robots.txt, then validate in Search Console’s robots report.
Ready to Generate Your robots.txt?
You know how groups and wildcards really match, why Disallow is not security, when Crawl-delay works, and why the Sitemap line matters. Scroll back up, add your rules, and download a crawler-grade robots.txt in a minute — everything generated locally in your browser.
