What robots.txt does and does not do
robots.txt is a text file at the root of your domain, for example https://www.example.com/robots.txt, that tells crawlers which paths they may crawl. Google describes it as a way to manage crawler traffic and avoid overloading your server, not as a way to keep pages out of Search. The rules are advisory: well-behaved crawlers follow them, others do not.
Three technical details explain many problems:
- It applies to one host:
www.example.com,example.comandshop.example.comeach have their own file. - It is cached: Google generally keeps it for up to 24 hours, so a fix does not take effect instantly.
- It has a size limit: Google ignores anything beyond 500 KiB.
Blocking crawling does not deindex
This is the most common misunderstanding. With Disallow, Google does not download the page, but if the URL has links it can still appear in results, without a description. To remove a page from the index you need the noindex meta tag or the X-Robots-Tag: noindex header.
The trouble starts when both are used together. Google explains that noindex only works if the page is not blocked by robots.txt: if the crawler cannot fetch it, it never sees the tag. The correct order is:
- add noindex and keep the page crawlable;
- wait until it drops out of the index, checking with URL Inspection;
- only then, if you need to save crawl activity, add the Disallow.
If Search Console lists pages as "Indexed, though blocked by robots.txt", this is almost always the cause.
Mistakes that block resources and whole sections
A forgotten Disallow: /
A Disallow: / line under User-agent: * blocks the entire site. It usually comes from development and stays live after launch. The drop is not immediate, so it often goes unnoticed for a few weeks.
Blocked CSS and JavaScript
Blocking folders such as /assets/ or /wp-includes/ stops Google from loading styles and scripts. Google warns that if the page is harder to understand without these resources, its analysis can suffer. Only block files that truly do not matter for rendering.
Rules broader than intended
Rules match by prefix and are case-sensitive. Disallow: /p also blocks /products/ and /pages/. Disallow: /*? blocks every URL with parameters, including pagination and filters you may want crawled. The * character matches any sequence and $ marks the end of the URL. When two rules conflict, Google applies the one with the longest path and, on a tie, the less restrictive one.
User-agent groups that cancel each other
A crawler follows only the most specific group that matches it. If you add a User-agent: Googlebot group with a single rule, Googlebot ignores everything under User-agent: *. Shared rules must be repeated in the specific group.
The file returns an error
A missing robots.txt (404) means no restrictions. A 5xx error is worse: according to Google's documentation, crawling of the site stops for the first 12 hours, then for up to 30 days Google uses the last cached version. A firewall or CDN that blocks or slows the request for the file can therefore halt crawling of the whole site.
Staging environments
Protect staging with a server-level password (HTTP auth) or IP restrictions. robots.txt is public and advisory: it actually advertises where your test environment is, and a Disallow does not stop linked URLs from being indexed.
The mirror risk comes at launch, when staging settings end up in production. In WordPress, the "Discourage search engines from indexing this site" option under Settings > Reading has, since version 5.3, added a noindex, nofollow robots meta tag rather than a robots.txt rule. After every launch, check both the file and the source code of your home page.
AI crawlers: how to handle them
Many AI crawlers use separate user agents for different purposes, so decide case by case:
- Google-Extended: controls use of your content for training Gemini models and for some grounding features. Google states it does not affect inclusion in Search or ranking.
- GPTBot: collects content OpenAI may use to train its models.
- OAI-SearchBot: determines whether you appear in ChatGPT search answers. Block it and the site is not shown there.
- ChatGPT-User: user-initiated visits; OpenAI notes robots.txt rules may not apply.
A common choice is to block training and allow search: a User-agent: GPTBot group with Disallow: /, and no rule for OAI-SearchBot. For making content useful to these systems, see the article on SEO for AI search.
robots.txt on Shopify and WordPress
Shopify
Shopify generates a default robots.txt that blocks admin, cart, checkout, customer account pages and filtered or sorted collection URLs. To change it, add the robots.txt.liquid template to your theme: Online Store, theme menu, Edit code, Add a new template, robots. Shopify advises against replacing the content with static text, because you lose future updates, and warns that incorrect use can cost all your traffic. Add your rules to the default template. The rest of the technical setup is covered in the Shopify technical SEO guide.
WordPress
WordPress serves a virtual robots.txt. SEO plugins let you edit it from the dashboard, but if you upload a physical robots.txt file to the root, that file wins and plugin changes have no effect. Two sources of truth for the same file are a common cause of confusion.
A correct robots.txt and how to test it
For a typical online store, a sensible file is short:
User-agent: *Disallow: /cartDisallow: /checkoutDisallow: /accountDisallow: /*?*sort=Sitemap: https://www.example.com/sitemap.xml
The Sitemap line needs an absolute URL and can point to several files; if Search Console reports sitemap problems, the causes are covered in the article on XML sitemap errors.
Before and after every change:
- open Search Console > Settings > robots.txt and check fetch status, last check date and any errors;
- after an urgent fix, use "Request a recrawl" from the same report;
- run URL Inspection on three or four key pages: product, category, article;
- make sure the file returns 200 quickly, even behind your CDN and firewall.
If Search Console is still unfamiliar, start with the Search Console guide for small businesses. If indexed pages are dropping and you suspect robots.txt or a recent migration, get in touch with your site URL and we will check it alongside the other likely causes.
- robots.txt
- seo tecnico
- disallow
- scansione
- indicizzazione
- crawler ai
- shopify
- search console
Frequently asked questions
Does robots.txt remove a page from Google?
No. It blocks crawling, but the URL can stay in results without a description if it has links. To remove it you need a noindex meta tag or header, and the page must stay crawlable until Google reads it.
Does blocking GPTBot or Google-Extended hurt SEO?
Google states that Google-Extended does not affect inclusion in Search or ranking. GPTBot concerns training of OpenAI models; appearing in ChatGPT search answers depends on OAI-SearchBot, which you should leave allowed if you want that visibility.
How do I edit robots.txt on Shopify?
Add the robots.txt.liquid template to your theme: Online Store, theme menu, Edit code, Add a new template, robots. Add rules to the default template rather than replacing it with static text.
How long until Google sees a new robots.txt?
Google generally caches the file for up to 24 hours. After an urgent fix you can request a recrawl from the robots.txt report in Search Console, though it does not guarantee immediate processing.
Sources
- Introduction to robots.txt — Google Search Central
- How Google interprets the robots.txt specification — Google Search Central
- Block search indexing with noindex — Google Search Central
- Google's common crawlers — Google for Developers
- robots.txt report — Search Console Help
- Overview of OpenAI crawlers — OpenAI
- Editing robots.txt.liquid — Shopify Help Center
- Settings Reading screen — WordPress.org
Related articles
Technical SEO · 6 min read
XML sitemap errors in Search Console and how to fix them
Search Console sitemap errors explained message by message: couldn't fetch, URL not allowed, invalid dates, index files, with Shopify, WordPress and Next.js cases.
Technical SEO · 6 min read
AI Search SEO: create citable content that earns visibility
A practical method for making content discoverable, understandable and evidence-led in AI search, without AEO hacks or promises of citations.
Technical SEO · 7 min read
Google Search Console for small businesses: setup and 6 reports to check monthly
How to verify your site in Search Console and which six reports to review each month to catch traffic drops, excluded pages and errors in time.
