robots.txt Disallow All: Staging Sites and Costly Mistakes

SEO tools and guides7 min read

A robots.txt disallow all rule is two lines that tell every well-behaved crawler to stay away from your entire site:

User-agent: *
Disallow: /

On a live website, that stops Google from crawling any page, and your listings gradually lose their descriptions or drop out of search. On a staging site, it's often used to keep a work-in-progress out of Google, but it isn't reliable for that either. Here's what the rule really does, what to use instead, and how to recover if it ends up on your live site.

What "Disallow: /" means, line by line

robots.txt is a plain text file at the root of your domain (

yourdomain.com/robots.txt
). Crawlers such as Googlebot read it before they crawl anything else.

  • User-agent: *
    means the rules below apply to every crawler. You can name a specific one instead, such as
    Googlebot
    .
  • Disallow: /
    blocks every path that starts with
    /
    , which is every URL on the site.

One character makes the difference between blocking everything and blocking nothing:

RuleEffect
Disallow: /
Blocks the whole site
Disallow:
(empty)
Blocks nothing. Same as having no rule
Disallow: /admin/
Blocks only URLs starting with
/admin/
Allow: /
Allows everything (the default)

Rules can also target one crawler. This blocks a single AI crawler and leaves everything else alone:

User-agent: GPTBot
Disallow: /

User-agent: *
Allow: /

Google's introduction to robots.txt covers the full syntax.

Disallow all blocks crawling, not indexing

This is the part most people get wrong. robots.txt controls whether Google can crawl (fetch) a page. It doesn't control whether a URL can appear in search results.

If other sites link to a blocked page, Google can still index the bare URL without ever reading it. The result looks like your page title or URL with a line saying no information is available for this page. In Search Console's Page indexing report, these show up as "Indexed, though blocked by robots.txt".

There's a second problem. Because Google can't fetch a blocked page, it can't see anything on it: the content, the canonical tag, a noindex tag, or any structured data, from breadcrumbs to the FAQ schema some sites still carry. So if you add noindex to a page and also block it in robots.txt, Google never sees the noindex. Google says this directly in its guide to blocking indexing with noindex.

To keep a page out of search results, let Google crawl it and use noindex. The difference between the two is explained further in our article on pages excluded by a noindex tag.

When robots.txt disallow all is the right choice

There are only a few good uses:

  • A development or staging copy that's also password protected, as an extra signal to tools that respect robots.txt.
  • A site that's being taken down, where you don't care about its search presence any more.
  • Internal tools on their own subdomain that should never be crawled.

It isn't the right tool for hiding a live site temporarily, for removing pages from Google, or for keeping private information private. robots.txt is public, and anyone can read it to see which paths you'd rather they didn't visit.

Keeping a staging site out of Google properly

The reliable way to keep a staging site private is to require a password. Googlebot can't log in, so it gets a 401 response and indexes nothing.

On Apache, add this to the staging site's

.htaccess
file (and create the password file with the
htpasswd
command):

AuthType Basic
AuthName "Staging"
AuthUserFile /home/youruser/.htpasswd
Require valid-user

On Nginx, add this inside the staging server block:

location / {
    auth_basic "Staging";
    auth_basic_user_file /etc/nginx/.htpasswd;
}

Many hosts offer the same thing as a "password protect directory" option in their control panel. Hosted platforms such as Wix, Squarespace and Shopify let you keep a site unpublished or password protected until launch.

If a password isn't possible, send a noindex header on every staging response and leave robots.txt open so Google can see it:

# Apache (needs mod_headers)
Header set X-Robots-Tag "noindex, nofollow"
# Nginx
add_header X-Robots-Tag "noindex, nofollow" always;

The costly mistake: launching with the staging robots.txt

The most expensive version of this problem happens on launch day. A developer builds the new site on staging with

Disallow: /
, the files are copied to the live server, and the rule comes along with them.

Nothing breaks visibly. The site loads, the client is happy, and traffic declines over the following weeks as Google stops refreshing the pages.

Signs that it has happened to you:

  • Search results show your pages with "No information is available for this page".
  • The Page indexing report in Search Console shows a sudden rise in "Blocked by robots.txt".
  • URL Inspection on your homepage says Crawl allowed? No: blocked by robots.txt.
  • You get an email from Search Console about new page indexing issues.

Our guide to the Blocked by robots.txt status explains how to tell an accidental block from a deliberate one.

How to recover

Move quickly, because every day the block stays in place more pages lose their snippets.

  1. Fix the file. Replace

    Disallow: /
    with the rules you actually want. For most small sites, this is enough:

    User-agent: *
    Disallow:
    
    Sitemap: https://www.yourdomain.com/sitemap.xml
    
  2. Check the live file. Open

    yourdomain.com/robots.txt
    in a private browser window. If you use a CDN or caching plugin, purge its cache, or you may still be serving the old version.

  3. Tell Google. In Search Console, go to Settings, open the robots.txt report and use Request a recrawl for the file. Google normally caches robots.txt for up to 24 hours, so this speeds things up.

  4. Request indexing for your key pages. Use URL Inspection on the homepage and your most important pages, then click Request indexing.

  5. Resubmit your sitemap in the Sitemaps report so Google has the full list of pages to revisit.

Most sites see pages come back within days to a few weeks, depending on how long the block was in place and how often Google normally crawls the site.

Platform notes

  • WordPress creates a virtual robots.txt if there's no physical file. The setting Settings > Reading > Discourage search engines from indexing this site adds a noindex tag to your pages, which is just as damaging on a live site. Untick it at launch. SEO plugins such as Yoast and Rank Math also have their own robots.txt editors.
  • Shopify generates robots.txt automatically. You can customise it with a
    robots.txt.liquid
    theme template, so check that template if the file looks wrong.
  • Wix lets you edit robots.txt in its SEO settings. Squarespace manages the file for you.
  • Next.js and other frameworks often generate robots.txt from code or environment settings. Make sure production builds don't use the staging configuration.

Preventing it next time

Add two checks to every launch:

  • Open
    /robots.txt
    on the live domain and read it.
  • Run URL Inspection on the homepage the same day.

They take two minutes. A full website redesign SEO plan covers the other launch-day checks, such as redirects and canonical tags, and the broader technical SEO checklist is worth running a week later. If you want to understand where robots.txt fits in a wider review, our guide on how to audit your website yourself puts it in context.

Checking this in seconds

The SapuSEO Copilot can check your robots.txt file along with your http/https and www redirects. Once you connect Google Search Console, it can also inspect a URL with Google's URL Inspection data, which shows the index status, whether robots.txt blocks the page and its crawl state.

Not sure if your homepage is blocked right now? Run the free site check and find out in about 30 seconds.

See what's holding your site back

Run a free site check. No account needed.

Check my site

More in SEO tools and guides