New: The $100M AI Visibility Roadmap, built from 7,960 live pages and 197 A/B tests. Get it free →

Home / Blog / Robots.txt Best Practices for SEO and AI Crawlers

Technical SEO · 12 min read

Robots.txt Best Practices for SEO and AI Crawlers

Block crawl traps, never block what you want ranked, use noindex to keep pages out of search, and choose your AI crawler rules on purpose. Here is how to do each one, with Shopify examples.

Robert Battle · Updated

Key takeaways
  • Robots.txt stops crawling, not indexing: use a noindex tag on a crawlable page to keep it out of Google, and a login to keep it private.
  • Google supports only User-agent, Allow, Disallow and Sitemap, reads the first 500 KiB, and caches the file for up to 24 hours.
  • A named user agent group replaces your * rules for that crawler, so repeat cart, checkout and account rules in every group you add.
  • On Shopify, edit robots.txt.liquid and keep robots.default_groups so you inherit Shopify's default rules, then read the rendered file.
  • Decide on AI crawlers deliberately: training bots like GPTBot and search bots like OAI-SearchBot can be allowed or blocked independently.

Robots.txt best practices come down to three rules: block only the URLs that waste crawling (cart, checkout, account, internal search, sort and filter combinations), never block pages or resources you want ranked, and use noindex, not Disallow, when you want a page out of search results. Then decide on purpose which AI crawlers may read your store, and test every change before it goes live, because one bad line can stop Google from crawling your whole site.

This guide is for Shopify and e-commerce teams who own their technical SEO. You'll get the rules Google and RFC 9309 actually follow, a block and allow table for a typical store, copy-ready robots.txt examples, a plain map of the AI crawlers, the mistakes that cost traffic, and a step-by-step way to ship changes safely.

What robots.txt does and what it can't do

A robots.txt file is a plain text file at the root of your domain (for example https://example.com/robots.txt) that tells crawlers which URLs they may request. Google describes its main job as managing crawler traffic so bots don't overload your site. It is the first file most well-behaved crawlers fetch, and it only covers the exact host, protocol and port it sits on, so shop.example.com and example.com each need their own file.

Robots.txt controls crawling, not indexing

This is the distinction that trips up most stores. Google's robots.txt introduction says the file is not a mechanism for keeping a web page out of Google. A disallowed URL can still be indexed if other pages link to it, and it can appear in results without a description. To keep a page out of search, let Google crawl it and add a noindex robots meta tag or X-Robots-Tag header. Google's noindex documentation is explicit that the rule only works if the page is not blocked by robots.txt, because a blocked crawler never sees the tag.

Robots.txt is not security

RFC 9309, the IETF standard for the Robots Exclusion Protocol published in September 2022, states that robots.txt rules are not a form of access authorization. Compliance is voluntary, and anyone can read your file. Listing a private folder in robots.txt can actually advertise it. Protect staging sites, customer data and wholesale price lists with a login, not a Disallow line.

Robots.txt syntax and the rules Google follows

A robots.txt file is made of groups. Each group starts with one or more User-agent lines, followed by the Allow and Disallow rules for those crawlers. Sitemap lines can go anywhere. Here is a minimal, valid file for a store:

User-agent: *
Disallow: /cart
Disallow: /checkout
Disallow: /account

Sitemap: https://example.com/sitemap.xml

FieldGoogle supportWhat it does
User-agentSupportedNames the crawler a group applies to. * means every crawler without a more specific group.
DisallowSupportedBlocks crawling of URLs that start with the path. An empty value blocks nothing.
AllowSupportedRe-opens a path inside a blocked folder. Wins over Disallow when the match is equally specific.
SitemapSupportedGives the full URL of an XML sitemap or sitemap index. You can list several.
Crawl-delayNot supportedIgnored by Google. Some other crawlers, such as Anthropic's, document support for it.
Noindex in robots.txtNot supportedNot a field Google lists. Use a meta robots tag or X-Robots-Tag header instead.

How matching works

  • Longest match wins. When an Allow and a Disallow rule both match a URL, Google uses the most specific rule, meaning the longest path. If they are equally long, the least restrictive rule (Allow) wins. RFC 9309 says the same: the match with the most octets wins, and Allow breaks ties.
  • Paths are case sensitive. Disallow: /Cart does not block /cart. Field names and user agent values are not case sensitive.
  • Two wildcards. * matches any sequence of characters and $ marks the end of the URL. Disallow: /*.pdf$ blocks URLs ending in .pdf, and Disallow: /*?q= blocks any URL containing ?q=.
  • Only one group applies. Google follows the group with the most specific matching user agent and ignores the rest. If you add a User-agent: Googlebot group, Googlebot stops reading your User-agent: * rules entirely, so repeat any rules you still need. Multiple groups for the same crawler are combined.

The limits that matter

The robots.txt limits Google applies
500 KiBFile size Google readsContent after the limit is ignored
24 hoursCache lifetimeGenerally, longer if Google can't refetch
5Redirect hops followedThen the file is treated as a 404
12 hoursCrawl pause on 5xxThen the last cached copy is used for up to 30 days

Source: Google Search Central, How Google interprets the robots.txt specification (updated 2026-10-23)

Google reads only the first 500 KiB of the file, caches it for up to 24 hours (longer if it can't refetch), and follows at least five redirect hops before treating the file as missing. Server errors are the dangerous case: if robots.txt returns a 5xx error, Google stops crawling the site for the first 12 hours while it retries, then falls back to the last cached copy for up to 30 days. A 404 or other 4xx status (except 429) is treated as if no robots.txt exists, which means no restrictions at all.

Robots.txt best practices for e-commerce stores

Most stores don't need a long file. They need a short one that blocks the right things and nothing else. These are the practices we'd apply to any Shopify or e-commerce store:

  1. Serve one file per host, at the root, with a 200 status. Check www, the bare domain and any market or language subdomains separately.
  2. Block crawl traps, not content. Cart, checkout, account, order pages, internal search results and endless sort or filter combinations are the usual candidates. Products, collections, blog posts and pages should stay open.
  3. Never block CSS, JavaScript or image files your pages need to render. Google says you can block non-essential resources only if the page still makes sense without them.
  4. Use noindex for pages that should be crawlable but not indexed, such as thin tag pages, and leave them unblocked so Google can see the tag.
  5. List your sitemap index with a full absolute URL in a Sitemap line.
  6. Keep rules simple and documented. Add # comments explaining why each custom rule exists and who added it.
  7. Treat specific user agent groups carefully, because they replace your * rules for that crawler instead of adding to them.
  8. Don't use robots.txt to shift crawl budget temporarily. Google's crawl budget guide says it won't move freed-up budget to other pages unless your site is already hitting its crawl capacity limit.
  9. Make an explicit AI crawler decision instead of inheriting whatever your platform ships.
  10. Test every change before and after it goes live.

How big sites actually use robots.txt

The HTTP Archive's 2025 Web Almanac SEO chapter, published January 15, 2026, gives a picture of real files across millions of sites. About 85% of robots.txt requests returned a 200 status, up from 84% in 2024, and 13% returned a 404. A 404 is not an error for crawling (Google treats it as "crawl everything"), but it also means you have no sitemap line and no control over AI crawlers.

HTTP status returned when crawlers request robots.txtDesktop sites; mobile figures are within 0.1 points
84.9% 200 13.3% 404 1% Timeout 0.5% 403 0.1% 500
View the data
Value
20084.9%
40413.3%
Timeout1%
4030.5%
5000.1%

Source: HTTP Archive, Web Almanac 2025, SEO chapter (published January 15, 2026)

Find out what your robots.txt is costing you

We'll check how your crawl rules, sitemap and indexing compare with your top three competitors on Google and AI answers, and list the fixes in order of revenue impact.

Get my technical SEO audit →

What to block and allow on a Shopify store

Shopify generates a robots.txt file for every store. We checked the live files of four large Shopify stores on October 27, 2026 (Allbirds, Kith, Gymshark and Ruggable). All four disallowed cart, checkout and account paths and collection URLs containing sort_by. Two of the four also disallowed /search, and none had a group for GPTBot or any other AI crawler. Two files contained Shopify's newer rule that blocks collection URLs combining two or more filters (/collections/*filter*&*filter*). Shopify does not publish the full default file in its docs, so check your own /robots.txt before you change anything.

URL typeExampleCrawl?Why
Products, collections, pages, blog posts/products/wool-runnerAllowThese are the pages that rank and sell.
Cart, checkout, account, orders/cart, /checkoutBlockNo search value, and blocked in every Shopify default file we checked.
Sorted collections/collections/shoes?sort_by=price-ascendingBlockSame products in a different order, multiplied across every collection.
Multi-filter combinations?filter.v.color=red&filter.v.size=9BlockCombinations explode into thousands of near-duplicate URLs.
Internal search results/search?q=bootsUsually blockInfinite URL space. If your file doesn't block it, check these pages carry noindex.
Single filters you've built landing pages for/collections/boots/waterproofAllowOnly if the page has unique copy and a self-referencing canonical.
Theme assets and CDN files/cdn/shop/files/...AllowGoogle needs them to render the page.

How to edit robots.txt on Shopify

Shopify's developer docs explain that you customize the file by adding a robots.txt.liquid template to your theme's Templates folder. Adding the template replaces the generated file, so Shopify recommends keeping its Liquid objects (robots.default_groups, group.rules, group.sitemap) so you still inherit future default rules. This pattern, based on Shopify's documented example, keeps every default and adds one rule for all crawlers:

{% for group in robots.default_groups %}
{{- group.user_agent }}
{%- for rule in group.rules -%}
{{ rule }}
{%- endfor -%}
{%- if group.user_agent.value == '*' -%}
{{ 'Disallow: /*?q=*' }}
{%- endif -%}
{%- if group.sitemap != blank -%}
{{ group.sitemap }}
{%- endif -%}
{% endfor %}

New user agent groups, such as an AI crawler rule, go as plain text after the loop. Shopify's docs also warn that the rendered output doesn't always match the generated file exactly, so save a copy of your current /robots.txt first and compare the two after you publish.

How to manage AI crawlers in robots.txt

AI companies now run several crawlers each, and they do different jobs. Blocking a training crawler keeps your content out of future model training. Blocking a search crawler can remove you from AI answers and the referral traffic they send. You can make these choices independently. OpenAI's documentation says each of its settings is independent of the others, and that it can take about 24 hours for its search systems to reflect a robots.txt change.

TokenCompanyPurposeWhat blocking it does
GPTBotOpenAICollects content that may be used to train modelsSignals your content shouldn't be used for training
OAI-SearchBotOpenAISurfaces sites in ChatGPT searchYour pages won't appear in ChatGPT search answers, except as navigational links
ChatGPT-UserOpenAIVisits pages when a user asks ChatGPTOpenAI says robots.txt rules may not apply because a user started the request
ClaudeBot / Claude-SearchBotAnthropicTraining data / search result qualityExcludes future training / may reduce visibility in Claude search
PerplexityBotPerplexityIndexes sites for Perplexity search results, not model trainingRemoves you from Perplexity's search index
Google-ExtendedGoogleControls use of content for Gemini training and groundingNo effect on Google Search inclusion or ranking

For most stores, the commercial case is to stay visible in AI search while deciding separately about training. This example opts out of OpenAI and Anthropic training while keeping both companies' search crawlers welcome:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: OAI-SearchBot
User-agent: Claude-SearchBot
User-agent: PerplexityBot
Allow: /
Disallow: /cart
Disallow: /checkout
Disallow: /account

Notice the last group repeats the cart, checkout and account rules. Because a named group replaces the * group for that crawler, leaving them out would open those paths to the search bots. Our guide on whether you should block GPTBot walks through the trade-off in detail, and GPTBot vs OAI-SearchBot explains the two OpenAI crawlers.

How many sites name AI crawlers

Explicit AI rules are still a minority practice. In the 2025 Web Almanac, GPTBot was the most-named AI crawler, appearing in 4.5% of desktop robots.txt files, while the catch-all * group appeared in about 77%. That means most sites, and most Shopify stores using the default file, let AI crawlers in by default without ever deciding to.

Share of robots.txt files that name each crawlerDesktop sites. The catch-all * group appears in about 77% of files
AdsBot-Google9.8%
Googlebot6.2%
GPTBot4.5%
ClaudeBot3.6%
CCBot3.5%
Google-Extended3.4%
PerplexityBot2.8%
View the data
Value
AdsBot-Google9.8%
Googlebot6.2%
GPTBot4.5%
ClaudeBot3.6%
CCBot3.5%
Google-Extended3.4%
PerplexityBot2.8%

Source: HTTP Archive, Web Almanac 2025, SEO chapter (published January 15, 2026)

Robots.txt is also not the same as llms.txt. Robots.txt sets crawl permissions that major crawlers honor. llms.txt is a proposed file that lists your important pages for AI tools, and Google says it ignores it. See llms.txt vs robots.txt for what each file does.

Let the right AI crawlers find your products

The free $100M AI Visibility Roadmap, built from 7,960 live pages and 197 A/B tests, shows how to get cited by ChatGPT, Google AI Overviews and Perplexity.

Get the free roadmap →

Common robots.txt mistakes that cost traffic

Most robots.txt damage comes from a handful of repeat errors. Use this grid when traffic drops after a theme change, migration or app install.

SymptomLikely causeFix
Crawling stops sitewide after a launchDisallow: / copied from a staging siteRemove it, then request recrawl of key URLs in Search Console
"Indexed, though blocked by robots.txt" in Search ConsolePage is blocked but linked from elsewhereIf it should rank, unblock it. If not, unblock it and add noindex
Noindexed pages still showing in GoogleThe same URLs are also disallowed, so Google never sees the tagRemove the Disallow rule until the pages drop out
Pages render broken in URL InspectionCSS, JavaScript or /cdn/ paths blockedAllow rendering resources
Googlebot crawls cart or checkout anywayA User-agent: Googlebot group without the default rulesCopy the needed rules into every named group
Crawling pauses for hours with no file changerobots.txt returning 5xx errors or timing outFix the server or CDN rule so the file returns 200 or 404

Two more to watch. Rules are case sensitive, so a rule written for /Collections/ won't match Shopify's lowercase paths. And remember the 500 KiB limit: the Web Almanac found very few files near it, but auto-generated files that list thousands of individual URLs can get there, and anything past the limit is ignored.

How to test and roll out robots.txt changes

Search Console's robots.txt report shows which robots.txt files Google found for the top 20 hosts on your site, when it last crawled them, and any warnings or errors. It also lets you request a recrawl of the file in an emergency. Use it together with a tester that checks specific URLs against specific user agents. Follow this sequence for every change:

  1. Save the current file. Copy /robots.txt from every host into your change log with today's date.
  2. List the URLs that must stay crawlable. Include your homepage, top collections, top products, blog posts and a CSS and JavaScript file from your theme.
  3. List the URLs you mean to block. Add real examples of each pattern, such as a sorted collection URL and a search URL.
  4. Test the draft. Paste it into our Robots.txt and AI Crawler Tester and check both lists against Googlebot, GPTBot, OAI-SearchBot, ClaudeBot and PerplexityBot.
  5. Publish. On Shopify, edit robots.txt.liquid; on other platforms, upload the file to the root of each host.
  6. Read the live file. Open /robots.txt in a browser, confirm a 200 status and check that every rule sits on its own line.
  7. Check Search Console. Open the robots.txt report, request a recrawl of the file if the change is urgent (the report works only for domain-level properties), and use URL Inspection on a few key pages.
  8. Watch for a week. Compare the Crawl Stats report and the Page indexing report against the week before the change.

It also helps to confirm that your sitemap and robots.txt agree. Every URL in your sitemap should be crawlable; a sitemap URL that robots.txt blocks is a mixed signal. Our XML Sitemap Checker fetches your sitemap and spot-checks that its URLs return 200 and are indexable.

A robots.txt routine you can keep

Robots.txt rarely needs weekly attention, but it needs an owner. Review it whenever you change themes, migrate platforms, add a market or subdomain, install an app that creates new URL patterns, or change your stance on AI crawlers. Once a quarter, open the live file, compare it to your last saved copy, and run your must-crawl list through a tester.

If the file and your crawl data disagree, the problem is usually bigger than robots.txt: duplicate URLs from filters, redirect chains or orphaned products. Our guides to crawl budget optimization and faceted navigation SEO cover those fixes. If you'd rather have someone audit the whole crawl path for you, our technical SEO team can help, or you can tell us about your store.

Want a second pair of eyes on your crawl setup?

Book a free 30-minute call. We'll benchmark you against your top three competitors, show the pages ready to move and the revenue math behind each fix.

Get my custom plan →
FAQ

Questions & answers

Does robots.txt remove a page from Google?
No. Robots.txt only stops crawling, and Google can still index a blocked URL if other pages link to it. To remove a page, allow crawling and add a noindex tag, or use Search Console's Removals tool for urgent cases.
Should I block AI crawlers in robots.txt?
Decide per crawler. Blocking training bots such as GPTBot or ClaudeBot keeps your content out of future training, while blocking search bots such as OAI-SearchBot or PerplexityBot can remove you from AI answers that send shoppers to your store.
Does Google support Crawl-delay?
No. Google ignores Crawl-delay. Some other crawlers, including Anthropic's ClaudeBot, document support for it, so it can still be useful for those bots.
Where is robots.txt on Shopify and can I edit it?
It is at yourstore.com/robots.txt. You can customize it by adding a robots.txt.liquid template to your theme, which replaces the generated file, so keep Shopify's default Liquid objects and compare the output to the original.
How long does a robots.txt change take to work?
Google generally caches robots.txt for up to 24 hours, and OpenAI says its search systems take about 24 hours to adjust. You can ask Google to recrawl the file sooner from Search Console's robots.txt report.
Free custom plan

Find the revenue you're leaving on the table

A free 30-minute call where we build the first version of your plan with you. You leave with a plan either way.

  • Your score across Google, AI citations, branded demand, and reviews
  • The pages on your site that are ready to move right now
  • Your first Flagship page and the first three tests we'd run

Step 1 of 3

Get your free custom plan

Free. Takes about 30 seconds.