How to use the robots.txt generator
- Enter your domain: Type your domain (e.g.
yourproduct.com). The generator automatically extracts your host origin and constructs the right sitemap URL. - Select common crawler paths: Enable or disable recommended blocks for back offices, internal search result pages, checkout funnels, or CMS admin areas.
- Configure AI scrapers and search bots: Choose whether to block AI model training crawlers (like GPTBot and ClaudeBot) while keeping conversational search bots (like OAI-SearchBot and PerplexityBot) open for citations.
- Add custom rules: Add specific Allow or Disallow directives for individual crawlers or all user agents.
- Test and download: Use the live URL tester to verify that your paths match expected rules according to RFC 9309, then copy the text or download your
robots.txtfile.
Safe defaults vs critical robots.txt mistakes
A single typo in a robots.txt file can accidentally remove an entire website from search engine results. Here are the crucial rules to protect your site’s organic search presence:
- Never block CSS, JS, or fonts: Search engines like Googlebot render your pages using an evergreen browser engine. Blocking stylesheets or script bundles prevents Google from rendering your page layout, often causing indexing drops or mobile-friendliness penalties.
- robots.txt is NOT access control: robots.txt is a publicly viewable plain text file. Listing sensitive private directories like
/secret-admin-folder-xyz/informs anyone reading the file exactly where your internal endpoints reside. Secure sensitive pages with authentication, not robots.txt directives. - Disallow does not guarantee de-indexing: If other sites link to a URL blocked in robots.txt, search engines can still index the link and show the URL in search results without reading page content. To ensure a page is omitted from search results, allow it to be crawled and place a
<meta name="robots" content="noindex" />tag on the page. - Always use trailing slashes for directories: Writing
Disallow: /adminblocks not just/admin/, but also public pages like/administration-guideor/administer-payments. WritingDisallow: /admin/restricts the block to the intended folder.
AI training scrapers vs AI search engines
As generative AI and answer engines grow, crawlers now fall into two distinct groups with different implications for your traffic:
- AI model training scrapers (such as
GPTBot,ClaudeBot,Google-Extended, andCCBot): These fetch content to train future foundation models. Blocking them prevents your content from being ingested without harming your rankings in traditional Google or Bing search. - AI conversational search crawlers (such as
OAI-SearchBot,Claude-SearchBot, andPerplexityBot): These power real-time conversational search engines and direct user queries. If you block these bots, assistants cannot browse your content or cite your product as a source in answer cards.
How rule matching works (RFC 9309)
Modern search engines follow the official IETF standard for robots exclusion (RFC 9309):
- Group precedence: A crawler first searches for a
User-agentgroup matching its specific name (e.g.Googlebot). If a matching group exists, it reads only that group and completely ignores the genericUser-agent: *group. - Longest match wins: Within a group, rules are evaluated by specificity. The longest matching path pattern decides whether a URL is allowed. For example, if you have
Disallow: /blog/(6 characters) andAllow: /blog/announcement(19 characters), the URL/blog/announcementis allowed. - Allow breaks ties: If an Allow rule and a Disallow rule have the exact same length and match the same URL, the standard dictates that
Allowwins.
Where to upload your file
Save your file as robots.txt (in lowercase) and upload it to the exact top-level root of your site:https://yourdomain.com/robots.txt. Crawlers never look for robots.txt in subdirectories.
If your product uses subdomains (such as app.yourdomain.com and docs.yourdomain.com), each subdomain requires its own independent robots.txt file.
In Next.js App Router, you can create a static file at app/robots.txt, or export a dynamic function from app/robots.ts returning a MetadataRoute.Robots object.
After uploading your robots.txt, audit your complete setup using the Website SEO checker, generate rich previews and Open Graph tags with the Meta tag generator, and check your domain’s backlink authority with the Domain rating checker.
