A page that should not be in Google turns up in Google. Someone checks robots.txt, finds the page is blocked there, and cannot understand how it got indexed. The answer is that robots.txt was never the tool for the job. It controls whether a crawler may fetch a page, not whether the page may be listed, and those are different questions with different answers.
Getting this right matters most for the pages people least want seen: staging sites, thank-you pages, internal search results, admin areas and duplicate versions of content.
Two different instructions
Robots.txt is a file at the root of a site that tells crawlers which addresses they may request. Google’s introduction to robots.txt describes its main use as avoiding overloading a site with requests, and states plainly that it is not a mechanism for keeping a web page out of Google.
Noindex is an instruction on the page itself, as a robots meta tag in the HTML or as an X-Robots-Tag HTTP header, that tells search engines not to show the page in results.
| Robots.txt Disallow | Noindex | |
|---|---|---|
| Where it lives | One file at the site root | On each page, or in its HTTP header |
| What it controls | Whether a crawler may fetch the address | Whether the page may appear in results |
| Can the page still be listed? | Yes, as an address without a description | No, once the instruction has been read |
| Does the crawler need access? | No; it stops at the file | Yes; it must fetch the page to see the tag |
How a blocked page ends up in search results
Google can learn that an address exists without ever fetching it: another site links to it, an old sitemap lists it, or it was crawled before the block was added. If robots.txt then stops the crawler from fetching the page, Google cannot see what is on it, but it still knows the address. Google says such a URL can still appear in search results, without a description.
The result looks broken to searchers and is the opposite of what the site owner wanted: the page is listed, and nothing on it can be used to explain or remove the listing.
The trap of using both
The instinct, when a page must disappear, is to do everything at once: add noindex and block the page in robots.txt. That combination defeats itself. Noindex only works when a crawler can fetch the page and read the tag. Block the page in robots.txt and the crawler never sees the noindex, so an address already known to Google can stay listed.
The order that works:
- Add noindex to the page, or send it as an X-Robots-Tag header.
- Leave the page crawlable so the instruction can be read.
- Wait for the page to drop out of results after it has been crawled again.
- Only then, if you want to save crawling, consider blocking it in robots.txt, accepting that a new link to it could bring the address back.
The robots.txt tester shows whether a given address is blocked for a given crawler, which is the first thing to check when a noindex seems to be ignored.
How to add noindex
For an HTML page, add a robots meta tag inside the head:
<meta name="robots" content="noindex">
For files that have no head, such as PDFs and images, the server can send the same instruction as an HTTP header, X-Robots-Tag: noindex. Most hosting setups let you add a header for a folder or a file type, and most content systems have a per-page setting that writes the meta tag for you.
Whichever method you use, check it from the outside. Open the page, view the source and look for the tag, or check the response headers in the browser’s developer tools. A setting that looks enabled in an admin screen is not always what the page actually sends.
Removing a page that is already indexed
If a page is already in search results and must come out, the order is:
- Decide whether the page should exist at all. If not, deleting it so it returns a 404 or 410 also removes it from results once it is recrawled, with no tag needed.
- If it should exist but not be listed, add noindex and leave it crawlable.
- For anything urgent, such as personal data published by mistake, Search Console’s removals tool can hide the address temporarily while the permanent fix takes effect. It is a stopgap, not a substitute for the tag or the deletion.
When to use which
| Situation | Use | Why |
|---|---|---|
| Internal search results, filtered lists, cart and checkout | Robots.txt Disallow | They waste crawling and rarely have links pointing at them |
| A thank-you page or a duplicate version of a page | Noindex | It must not be listed, and it may be linked to |
| A whole staging site | A password | Neither instruction stops people or careless crawlers from reading it |
| Images, PDFs and other files that are not HTML | X-Robots-Tag: noindex | There is no head for a meta tag |
| Pages that should be listed, but under another address | A canonical tag or a redirect | Neither is about hiding; both consolidate |
The robots.txt generator writes the Disallow rules for areas that should not be crawled, and the meta tag generator adds a noindex robots tag to a page’s head when you choose to keep it out of results.
A staging site needs a password
The most common robots.txt accident is a development copy of a site, blocked with Disallow: / and then found in search results anyway, because someone linked to it. A staging site should sit behind a password or an IP allowlist. That keeps out crawlers and people alike, and there is nothing to remember to remove at launch.
The second most common accident is the reverse: the Disallow: / that protected the staging site is copied to the live site at launch. Every page then becomes uncrawlable at once. If organic traffic falls sharply the week after a launch, the live robots.txt is the first file to open.
What robots.txt is good for
None of this makes robots.txt useless. It is the right tool for keeping crawlers out of areas that have no value in search and could generate endless addresses: internal search with every query as a new URL, faceted filters with every combination as a page, calendars with an address for every future date. Blocking those protects the crawling of the pages you do want found.
It is also where you point crawlers to your sitemap, with a Sitemap: line holding the full URL, and the only practical way to ask a named crawler to stay out of the whole site.
Questions to ask before blocking anything
Before adding a line to robots.txt, three questions keep most accidents away:
- Should this page be found by people searching? If yes, it must be crawlable. If no, decide whether it must also stay out of results, which is a job for noindex.
- Does anything outside the site link to it? Linked pages are the ones that end up listed as bare addresses when blocked.
- Does the page need resources from the blocked area? Blocking a folder of scripts or styles can stop crawlers rendering pages that are allowed.
Other ways to keep content out of results
Robots.txt and noindex are the two tools people reach for first, but they are not the only ones, and sometimes another is better.
- A password or a login. Content behind authentication cannot be crawled or indexed at all. This is the right answer for anything private, from staging sites to client areas.
- Deleting the page. A page that should not exist is better removed, returning a 404 or 410, than kept and hidden.
- A canonical tag. For a duplicate that should not compete with the original, a canonical tag pointing to the original consolidates the two instead of hiding one.
- A redirect. For an old page replaced by a new one, a permanent redirect sends visitors and signals to the new page.
Each answers a slightly different question. Hiding a page, removing it, merging it and moving it are four different intentions, and choosing the tool that matches the intention avoids most of the problems described above.
Where nofollow fits
The robots meta tag can also carry nofollow, which asks search engines not to follow the links on the page. It is often added alongside noindex out of habit, and usually it is not needed. A page kept out of results can still pass visitors and crawlers on to the pages it links to, and for a thank-you page or a filtered list that is exactly what you want. Use noindex on its own unless there is a specific reason not to trust the links on the page, such as content written by other people that you have not checked.
Checking a site in ten minutes
Open the live robots.txt and read every Disallow line, asking of each: is this an area that should not be crawled, or a page that should not be listed? Move the second kind to noindex. Then test a handful of important addresses against the file to confirm they are allowed, and a handful of private ones to confirm they are blocked or carry noindex. Finally, check that the sitemap lists none of the noindex pages; how to submit a sitemap to Google covers what belongs in it.
Sources, read November 14, 2026:
- Google Search Central, Introduction to robots.txt: used mainly to manage crawler traffic, not a mechanism for keeping a page out of Google, and a blocked URL can still appear in results without a description.