How to create a robots.txt file
- Start from a preset: Allow all for most sites, Block AI training to opt out of AI model training, or Block all for staging sites.
- List any folders or pages crawlers should skip, such as
/admin/,/cartor internal search results. - Add your sitemap URL so every crawler can find your pages.
- Fine-tune individual crawlers if needed, then check any URL in the tester.
- Download
robots.txtand upload it to the root of your site.
Robots.txt syntax
User-agent: * Disallow: /admin/ Disallow: /*?sort= Allow: /admin/help.html User-agent: GPTBot Disallow: / Sitemap: https://example.com/sitemap.xml
| Directive | Meaning |
|---|---|
User-agent | Which crawler the following rules apply to; * means any crawler without its own group |
Disallow | Paths the crawler must not fetch. Disallow: / blocks everything; an empty Disallow: allows everything |
Allow | An exception inside a blocked folder |
* and $ | * matches any characters; $ marks the end of the URL (/*.pdf$ blocks PDFs) |
Sitemap | Full URL of a sitemap; can appear anywhere, any number of times |
Crawl-delay | Seconds between requests; respected by Bing and Yandex, ignored by Google |
How crawlers decide which rule applies
- One group per crawler. A crawler follows only the most specific group that names it. If Googlebot has its own group, it ignores the
*group entirely, so repeat any shared rules. - Longest match wins. Within a group, the rule with the longest matching path decides.
Allow: /admin/help.htmlbeatsDisallow: /admin/. - Allow wins a tie. If an Allow and a Disallow rule are equally long, Google allows the URL.
- Paths are case-sensitive.
/Admin/and/admin/are different paths.
The tester above applies exactly these rules and shows which line made the decision.
Search crawlers vs AI crawlers
| Type | Examples | If you block them |
|---|---|---|
| Search engines | Googlebot, Bingbot, Applebot | Your pages drop out of search results |
| AI training | GPTBot, ClaudeBot, Google-Extended, CCBot | Your content isn't used to train future models; search rankings are unaffected |
| AI search and answers | OAI-SearchBot, Claude-SearchBot, PerplexityBot | You won't be cited or linked in AI answers |
Google-Extended is a control token rather than a separate crawler: blocking it stops Google using your content for Gemini training without affecting Google Search. Robots.txt is a request, not a lock; to keep private content private, use a login or server rules.
Common robots.txt mistakes
- Leaving
Disallow: /from a staging site on the live site, which removes it from Google. - Blocking CSS and JavaScript. Google needs them to render the page and judge whether it's mobile-friendly.
- Using robots.txt to hide pages from search. Use a
noindextag instead, and don't block the page, or Google can't see the tag. - Relative sitemap URLs.
Sitemap:needs the fullhttps://address. Create one with the XML sitemap generator. - Files over 500 KiB. Google ignores everything after the first 500 KiB.
Comments 0
No comments yet.