Robots.txt: what it is, examples for stores, and mistakes that sink your SEO
There's a file of a few lines that can drop your store from Google without anyone noticing for weeks. It's called robots.txt, and almost nobody checks it until organic sales fall or until they discover ChatGPT can't read their product pages.
Before touching it, it's worth understanding robots.txt well: what it is, what it controls and, above all, what it doesn't control. Here you'll see the syntax without jargon, an example for WooCommerce, how it works on Shopify, what to do about AI bots, and the mistakes that do the most damage. When you're done, you'll be able to read yours line by line and know whether it's helping you or sabotaging you.
In short:
- Robots.txt tells each crawler which paths it can visit; it doesn't remove pages from Google (that's what noindex is for).
- In a store, use it so bots don't get lost in carts, site searches, and re-sorted listings.
- AI bots aren't all the same: some feed search engines that can cite you and others collect content to train models.
- A forgotten "Disallow: /" or an overly broad rule can lock out your categories and products.
- Test every change in Search Console before forgetting about the file.
Robots.txt explained: what the file is and how search engines read it
The robots.txt file is a plain text file published at the root of the domain, for example https://yourstore.com/robots.txt. Before crawling your site, bots that respect the standard read it to know which paths they're allowed to visit. It's a request, not a lock: serious crawlers comply, but it doesn't stop anyone from visiting those pages.
Three details from the robots.txt specification Google applies worth memorizing:
- Only the file at the root counts, and it applies only to the host, protocol, and port where it's published. If you have
blog.yourstore.com, that subdomain needs its own robots.txt. - Paths are case-sensitive:
/Sale/and/sale/are different rules. - Google processes at most 500 KiB; anything beyond that size is ignored.
Most importantly: robots.txt controls crawling, not indexing. If you block a URL but other sites link to it, Google may index it anyway and show it without a description. To keep a page out, use noindex and let Google crawl it so it can read it. If the problem is duplicate versions of a page, the right tool is usually the canonical tag.
The syntax in five minutes: user-agent, disallow, allow, and sitemap
A robots.txt file is organized into groups. Each group starts with one or more User-agent lines (who you're talking to) and continues with Disallow rules (don't go in) or Allow rules (you can go in). The Sitemap line goes separately and tells search engines where your XML sitemap is.
| Directive | What it does | Example |
|---|---|---|
User-agent |
Indicates which crawler the group applies to; * means "all" |
User-agent: * |
Disallow |
Asks not to crawl paths that start with that value | Disallow: /cart/ |
Allow |
Allows a path inside a blocked one | Allow: /wp-admin/admin-ajax.php |
Sitemap |
Points to the full URL of your sitemap | Sitemap: https://yourstore.com/sitemap_index.xml |
There are two wildcards: * means "any sequence of characters" and $ marks the end of the URL. So Disallow: /*.pdf$ blocks URLs ending in .pdf. When several rules match a URL, Google applies the most specific one (the one with the longest path) and, if they conflict, the least restrictive one.
A fact that confuses many people: Google doesn't support the Crawl-delay directive; it simply ignores it.
Robots.txt in WordPress and WooCommerce: an annotated example
If you've never created the file, WordPress serves a virtual one that blocks /wp-admin/, allows /wp-admin/admin-ajax.php and, since version 5.5, adds the Sitemap line when the site is public. SEO plugins usually change that line to their own sitemap.
In a WooCommerce store it's worth going further. If you were looking for a robots.txt example ready to adapt, this one covers the typical cases; adjust the paths to your store's real slugs:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
# Pages with no value in search engines
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
# Site search, buy buttons, and re-sorted listings
Disallow: /?s=
Disallow: /*add-to-cart=
Disallow: /*?*orderby=
Sitemap: https://yourstore.com/sitemap_index.xml
- Cart, checkout, and account: they have nothing to rank; every bot visit there is wasted crawling.
/?s=: it cuts off site searches, which can generate almost unlimited URLs.add-to-cart=: it keeps bots from following the buy buttons on listings.orderby=: it blocks listings sorted by price or popularity, which repeat the category. The/*?*pattern catches the parameter even when it isn't the first one.
What about filters? If a combination has no searches of its own, blocking its crawling saves resources; if it has real demand ("women's running shoes"), you may be better off with an optimized page. Decide filter by filter and check which parameter your plugin uses (in WooCommerce they usually start with filter_).
Shopify: a robots.txt that comes preconfigured
On Shopify you don't start from scratch. Every store has a default robots.txt that, according to Shopify's official help, already blocks the admin panel, the cart, the checkout, account and order pages, and filtered or sorted collection URLs.
If you need to change it, create the robots.txt.liquid template in your theme's code and add or remove rules with Liquid. Shopify warns that it's an unsupported customization and that incorrect use can cost you all your traffic. Do it only for a specific need and don't replace the template with fixed text: you'd stop receiving updates to its default rules.
AI bots in your robots.txt: GPTBot, OAI-SearchBot, ClaudeBot, PerplexityBot, and Google-Extended
This is the decision that raises the most questions. The key: each company separates its bots by function. Some feed the search engine that can cite you and others collect content to train models.
| Bot | Company | What it's for | If you block it |
|---|---|---|---|
| OAI-SearchBot | OpenAI | Showing sites in ChatGPT search | You stop appearing in its search answers |
| GPTBot | OpenAI | Collecting content to train models | You ask that it not be used for training |
| ClaudeBot | Anthropic | Collecting content to train models | Your future content stays out of training |
| Claude-SearchBot | Anthropic | Indexing content for Claude's search | You may lose visibility in Claude |
| PerplexityBot | Perplexity | Showing and linking sites in its results; doesn't train models | Perplexity doesn't crawl your site for its results |
| Google-Extended | Controlling use for training Gemini and grounding Gemini app answers | It doesn't change your inclusion or ranking in Google Search |
According to OpenAI's crawler documentation, its search can take about 24 hours to reflect a change in your robots.txt. OpenAI also clarifies that ChatGPT-User, the agent that visits pages when a person asks it to, may not follow these rules; Perplexity says something similar about Perplexity-User.
There's a frequent misunderstanding about Google-Extended. As Google's common crawlers documentation explains, it doesn't have its own crawler: it's a control token, and blocking it doesn't remove you from Google Search. Your appearances in AI Overviews and AI Mode depend on Googlebot.
For a store that wants to sell, the reasonable approach is to let search bots through and decide separately whether you hand over content for training. Since they're different bots, you can block some and allow others:
# At the end of your robots.txt: don't hand over content to train models
User-agent: GPTBot
User-agent: ClaudeBot
Disallow: /
An important technical detail: a bot with its own group stops reading the User-agent: * rules. That's why it isn't a good idea to create a separate group for OAI-SearchBot or PerplexityBot; if you don't name them, they follow the general rules and respect your blocks. Before adding Google-Extended, think about whether you want to feed the Gemini app's answers. If your goal is to be recommended, continue with how to rank in ChatGPT and with the llms.txt file, which serves a different function, or see our AI SEO page.
Robots.txt disallow mistakes that sink your SEO
- Leaving the development-stage
Disallow: /. It blocks the whole site. It happens a lot when launching or migrating a store. - Using robots.txt to "deindex". The URL may stay on Google without a description and, if it has noindex, Google will never read it.
- Overly broad rules.
Disallow: /productalso blocks/products-featured/. Close paths with/and test before publishing. - Blocking CSS, JavaScript, or images the page needs. If Google understands the page worse without them, don't block them. Check inherited rules on
/wp-content/or/wp-includes/. - Forgetting about letter case.
Disallow: /Sale/doesn't block/sale/. - Creating a group for one bot and forgetting the general rules. That bot will ignore what you put under
User-agent: *. - A robots.txt that responds with a server error. If your server returns a 5xx error when the file is requested, Google stops crawling the site for the first 12 hours and then uses the last saved version. Unstable hosting slows down your indexing without you noticing.
- Believing blocking hides information. The file is public; private things are protected with a password.
How to test your robots.txt file before it costs you sales
- Open
yourstore.com/robots.txtin your browser and look for any strayDisallow: /. - Check Search Console's robots.txt report: it shows which files Google found, when it crawled them, and whether there were problems reading them.
- With the URL Inspection tool, test a product page and a category; if they show as blocked, something's wrong. We explain the process in how to request indexing in Google Search Console.
- After fixing a serious error, request a recrawl of the file from that report. Google usually caches it for up to 24 hours.
- Confirm that the
Sitemapline points to an XML sitemap that exists and is up to date.
If your store uses WooCommerce, SEOXtreme includes a robots.txt manager with rules for AI crawlers and generates your XML sitemaps, and any change it makes can be reverted. More details in WooCommerce SEO with AI.
Conclusion: five minutes that protect your traffic
Robots.txt is short, but it has veto power over all your SEO. Open it today, compare it with the example in this guide, and make a conscious decision about AI bots: allow the ones that can cite you and choose what you hand over for training.
Then check that your important pages are in the index with the guide on why Google isn't indexing your site and review the rest with the ecommerce technical SEO checklist. You'll find more guides in the Technical SEO section.
Frequently asked questions
What is the robots.txt file and what is it for?
It's a text file that lives at the root of your domain (for example, yourstore.com/robots.txt) and tells crawlers which paths they can visit and which they can't. It's used to manage crawling: so bots don't waste time on carts, site searches, or sorted listings. It isn't used to remove pages from Google; for that you use the noindex tag.
Can robots.txt deindex a page?
No. If you block a URL in robots.txt, Google stops crawling it, but it may still show it in results, without a description, if other sites link to it. To remove it from the index use noindex, either in the robots meta tag or the X-Robots-Tag header, and leave the page crawlable: if you block it, Google will never get to read that noindex.
Where is robots.txt in WordPress?
If you haven't uploaded a physical file, WordPress generates a virtual one at yourdomain.com/robots.txt that blocks /wp-admin/ and allows admin-ajax.php. Since version 5.5 it also adds a Sitemap line when the site is public. You can replace it with a real file at the server root or edit it from your SEO plugin, if it offers that option.
Should I block GPTBot in my store's robots.txt?
It depends on what you want to protect. According to OpenAI, GPTBot collects content that may be used to train its models, while OAI-SearchBot is the bot that lets your site appear in ChatGPT's search answers. You can block the first and allow the second. If your goal is for ChatGPT to recommend your products, don't block OAI-SearchBot.
How long does Google take to see changes to my robots.txt?
Google usually caches robots.txt for up to 24 hours, so a change can take about a day to apply. If you fixed a serious error, such as an accidental block of the whole site, you can request a recrawl of the file from Search Console's robots.txt report, although that doesn't guarantee your URLs will be crawled right away.
What happens if my store has no robots.txt?
Nothing serious: if the file doesn't exist and the server responds with a 404, Google assumes there are no restrictions and can crawl everything. The risk lies elsewhere: without rules, bots spend resources on cart or site search URLs. And if the server responds with a 5xx error when the file is requested, Google temporarily stops crawling the site.
Sources
- How Google interprets the robots.txt specification (Google Crawling Infrastructure)
- Introduction to robots.txt (Google Search Central)
- Google's common crawlers: Google-Extended (Google Crawling Infrastructure)
- AI features and your website (Google Search Central)
- Overview of OpenAI Crawlers (OpenAI)
- Does Anthropic crawl data from the web, and how can site owners block the crawler? (Anthropic)
- Perplexity Crawlers (Perplexity)
- Editing robots.txt.liquid (Shopify Help Center)
Written and reviewed by the SEOXtreme editorial team using official sources (Google Search Central, platform documentation, and published studies). If you spot outdated information, email us at hola@vidaxtreme.com.