A robots.txt file is a small text file at the root of your website that tells search engine crawlers and AI bots which parts of the site they may crawl. One wrong line can stop Google crawling your whole shop, so it is worth getting right. This guide explains the syntax, gives working examples for WordPress and Shopify, covers AI crawlers such as GPTBot and Google-Extended, and shows how to test changes. If you want a specialist to check your setup, our ecommerce SEO agency page explains how we work.

Rules below come from Google Search Central, Shopify, OpenAI and Anthropic documentation, checked in November 2026.

Quick Answer

Robots.txt lives at yourdomain.co.uk/robots.txt. It uses four fields that Google supports: User-agent, Allow, Disallow and Sitemap. Use it to stop crawlers wasting time on pages such as internal search results, baskets and filter URLs, and to opt out of AI training bots if you want to. Do not use it to hide pages from Google: a blocked URL can still be indexed. Use a noindex tag for that.

Worried a robots.txt rule is blocking sales pages?

Send us your domain. We will check your robots.txt against your important pages and tell you what to change.

Get a free robots.txt check

What Robots.txt Does and Does Not Do

Google's introduction to robots.txt says the file is mainly used to manage crawler traffic so your site is not overloaded. It also says clearly that it is not a way to keep a page out of Google. If other pages link to a blocked URL, Google can still index it, usually showing the address with no description.

Robots.txt canRobots.txt cannot
Ask crawlers not to fetch certain URLs or foldersRemove a page from Google's index
Set different rules for different botsForce a bot to obey it; it relies on bots choosing to follow it
Point crawlers to your XML sitemapProtect private content; anyone can read the file
Reduce crawling of low-value URLs, such as filtersStop people visiting a URL directly

A common mistake: blocking a page in robots.txt and adding a noindex tag to it. Google's robots meta tag documentation explains that if a page is blocked from crawling, Google cannot see the noindex rule, so the rule is ignored. To remove a page from Google, allow crawling and use noindex.

Robots.txt Syntax and Rules

Google's robots.txt specification sets out how Google reads the file. The key rules:

  • Location: the file must be in the top-level directory of the host, for example https://www.yourshop.co.uk/robots.txt. Each subdomain needs its own file.
  • Fields Google supports: user-agent, allow, disallow and sitemap. Other fields, such as crawl-delay, are ignored by Google.
  • Size: Google reads the first 500 KiB. Anything after that is ignored.
  • Caching: Google generally caches the file for up to 24 hours, so changes are not instant.
  • Wildcards: * matches any sequence of characters; $ marks the end of the URL.
  • Which rule wins: the most specific matching rule, judged by the length of the path. If an allow and a disallow rule are equally specific, the less restrictive one (allow) wins.
  • Groups: a crawler follows only the most specific group that names it. If you write a group for Googlebot, Googlebot ignores the User-agent: * group.

What happens if the file is missing or broken

Server response for /robots.txtHow Google treats it
200 (found)Reads and follows the rules
404 or other 4xx (except 429)Treats the site as having no restrictions
5xx server errorStops crawling the site for the first 12 hours, then uses the last good copy for up to 30 days
RedirectFollows up to five redirect hops

The 5xx row matters. If your server returns errors for robots.txt, Google may pause crawling of the whole site. That is a hosting issue to fix quickly.

Common Robots.txt Examples

Allow everything

User-agent: *
Disallow:

Sitemap: https://www.yourshop.co.uk/sitemap.xml

Block internal search results and basket pages

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

Block sorting and filter parameters

User-agent: *
Disallow: /*?*sort_by=
Disallow: /*?*filter.

Test any wildcard rule before you publish it. A pattern that is slightly too broad can block your collection pages. Our pagination SEO guide explains how to handle paginated and filtered category pages.

Block one folder but allow one file inside it

User-agent: *
Disallow: /private/
Allow: /private/price-list.pdf

The Allow rule wins here because it is longer and more specific.

Block a whole staging site

User-agent: *
Disallow: /

Use with care: this is the line that most often ends up on a live site after a redesign. It stops all compliant crawlers fetching any page. For staging sites, password protection is safer, because it also keeps the pages out of Google.

Robots.txt on WordPress

WordPress creates a virtual robots.txt if there is no real file on the server. The WordPress developer reference for do_robots() shows the default output: a User-agent: * group that disallows the admin area and allows admin-ajax.php. Recent versions also add a link to the built-in sitemap. A typical result looks like this:

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://www.yourshop.co.uk/wp-sitemap.xml

You have three ways to change it:

  1. SEO plugin editor. Rank Math and Yoast both include a robots.txt editor. This is the easiest option, and the plugin usually adds its own sitemap URL.
  2. A real file. Upload a robots.txt file to the site root by FTP or your host's file manager. A real file replaces the virtual one, so plugin edits will no longer show.
  3. The robots_txt filter. Developers can change the virtual output in code.

The "Discourage search engines" box

In WordPress, Settings, then Reading, has a box called "Discourage search engines from indexing this site". Since WordPress 5.3 this works through a robots meta tag rather than a robots.txt rule, according to the developer reference. If organic traffic suddenly drops after a site launch, check this box first.

For WooCommerce shops, consider blocking basket, checkout and my-account pages, plus any add-to-basket parameters. Do not block /wp-content/ or /wp-includes/. Google needs the CSS and JavaScript in those folders to render your pages.

Robots.txt on Shopify: robots.txt.liquid

Shopify generates a sensible robots.txt for every store. It already blocks the basket, checkout, account pages, internal search and many sorting and filter URLs. For most shops, the default is fine.

If you need to change it, Shopify's robots.txt.liquid documentation explains the method. In the theme code editor, add a new template called robots.txt.liquid. This template replaces Shopify's generated output, so you build on the default groups rather than starting from nothing. To add one Disallow rule for all bots:

{% 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 %}

To block a specific crawler, add a new group after the loop:

User-agent: GPTBot
Disallow: /

Good practice: Shopify advises saving a copy of your current /robots.txt before you publish the template, then comparing the new output line by line. Keep the default rules unless you have a clear reason to remove one. Our Shopify SEO guide covers the other Shopify settings that affect crawling.

AI Crawlers: GPTBot, Google-Extended and Others

Many UK businesses now ask whether they should block AI bots. Robots.txt is how most AI companies say you can opt out. The important detail is that most providers now run separate bots for training and for search or live answers. Blocking the wrong one can remove you from AI search results without stopping training, or the other way round.

User-agent tokenCompanyUsed for
GPTBotOpenAICrawling content that may be used to train OpenAI's models
OAI-SearchBotOpenAIShowing sites in ChatGPT search features
ChatGPT-UserOpenAIVisiting pages when a ChatGPT user asks; OpenAI says robots.txt rules may not apply
Google-ExtendedGoogleControls whether content Google crawls may be used for Gemini model training and grounding. Not a separate crawler
ClaudeBotAnthropicCollecting web content that may be used for training
Claude-SearchBotAnthropicImproving search results for Claude users
Claude-UserAnthropicFetching pages when a Claude user asks a question

Sources: OpenAI's crawler overview, Google's list of common crawlers and Anthropic's crawler help article. OpenAI says its settings are independent, so you can allow OAI-SearchBot while blocking GPTBot. Google says Google-Extended does not affect inclusion or ranking in Google Search.

Example: stay in AI search, opt out of training

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: OAI-SearchBot
Allow: /

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

Remember the group rule above: a bot with its own group ignores the * group. If you want OAI-SearchBot to skip your basket and checkout too, repeat those lines in its group.

Should an ecommerce shop block AI bots?

For most UK shops, being found in AI answers is now a sales channel. Blocking search-related bots can remove you from those answers. Many brands choose to allow search and user bots and decide separately about training bots. It is a business decision; there is no right answer for everyone. Our generative engine optimisation guide explains how AI search visibility works.

Testing Robots.txt in Search Console

Google retired its old robots.txt Tester and replaced it with a robots.txt report, as Search Engine Land reported. Google's robots.txt report help page explains that it shows the robots.txt files Google found for the top 20 hosts on your property, when each was last checked, whether it was fetched, and any errors or warnings. After an urgent fix, you can use the menu next to a file to request a recrawl.

The report is available only for Domain properties and URL-prefix properties at the root of a site. To check whether a specific URL is blocked, use URL Inspection on that URL. It tells you whether crawling is allowed. Our Google Search Console guide walks through both tools.

A safe change process

  1. Copy the current live file and save it with the date.
  2. Write the new rules and check them against a list of your most important URLs: home page, top collections, top products, blog.
  3. Publish the change.
  4. Open yourdomain.co.uk/robots.txt in a private browser window to confirm the live version.
  5. Check the robots.txt report in Search Console after Google has refreshed it.
  6. Watch the Page indexing report for a rise in "Blocked by robots.txt" over the next few weeks.

Robots.txt Mistakes That Cost Traffic

  • Leaving Disallow: / on after launch. The classic. Check robots.txt on launch day of any new site or theme.
  • Blocking CSS and JavaScript. Google needs them to render pages. Blocked resources can affect how pages are understood.
  • Using robots.txt to remove pages. Use noindex or delete and redirect instead.
  • Blocking pages that carry noindex or canonical tags. Google cannot see tags on pages it cannot crawl.
  • Relying on crawl-delay for Google. Google ignores it.
  • Using robots.txt as security. Anyone can read the file. Listing secret folders in it advertises them.
  • Forgetting subdomains. shop.yourbrand.co.uk needs its own robots.txt.

Our technical SEO checklist covers the other crawl and index checks to run alongside robots.txt.

Why UK Ecommerce Brands Choose Growth Pulse Media

We check robots.txt, noindex rules, canonicals and sitemaps together, because they only work when they agree with each other. On Shopify we work with the default rules and add only what the store needs; on WordPress we make sure plugins, real files and the reading settings do not clash. Our ecommerce SEO agency service covers this as part of every technical audit.

SEO starts from £1,500 a month and AEO from £1,500 a month, with no lock-in contract. You deal directly with the founder-led team doing the work.

Who This Is NOT For

Sites trying to hide confidential content. Robots.txt is public and voluntary. Use proper authentication for anything private.

Shops hoping robots.txt alone will fix rankings. It controls crawling. Rankings depend on content, links and site quality too.

Anyone wanting to block all bad bots. Scrapers that ignore robots.txt need firewall or bot management rules, not more robots.txt lines.

Frequently Asked Questions

Where is my robots.txt file?

Add /robots.txt to the end of your domain, for example https://www.yourshop.co.uk/robots.txt. It must sit at the root of the host. Each subdomain needs its own file.

Can robots.txt stop a page appearing in Google?

Not reliably. Google says a blocked URL can still be indexed if other pages link to it. To keep a page out of results, allow crawling and add a noindex robots meta tag, or protect it with a password.

Can I edit robots.txt on Shopify?

Yes. Add a robots.txt.liquid template in your theme code. It replaces Shopify's generated file, so build on the default groups and compare the output with the original before publishing.

Does Google support crawl-delay?

No. Google's robots.txt specification lists crawl-delay as an unsupported field that Google ignores. Some other search engines do read it.

Does blocking Google-Extended remove my site from Google Search?

No. Google says Google-Extended does not affect inclusion in Google Search and is not a ranking signal. It controls whether content may be used for Gemini model training and grounding.

How long do robots.txt changes take to work?

Google generally caches robots.txt for up to 24 hours. OpenAI says changes for its search bot can take about 24 hours. You can request a recrawl of the file in the Search Console robots.txt report after an urgent fix.

Want your crawl settings checked properly?

We will review your robots.txt, noindex tags, canonicals and sitemaps together and send you a clear list of fixes.

Book your free technical SEO check

Dirk van Greuning — Founder, Growth Pulse Media
Dirk van Greuning Founder, Growth Pulse Media

Dirk has worked in digital marketing since 2016. He built and scaled an ecommerce business before starting Growth Pulse Media, and now runs SEO, Google Ads, Meta ads and email for ecommerce brands. Growth Pulse Media is a Shopify Partner and a Premium Omnisend Partner.

Connect on LinkedIn