Technical SEO
noindex vs robots.txt disallow: which one keeps a page out of Google
For noindex vs robots.txt, the rule is simple: use noindex to keep a page out of Google, and robots.txt only to stop crawling. A robots.txt disallow does not remove a page: Google can still list a blocked URL if other pages link to it. Never use both on one URL, because a blocked page cannot be crawled, so Google never sees its noindex. To remove an indexed page, allow crawling, add noindex, and wait for a recrawl.
What is the difference between noindex and a robots.txt disallow?
They control two different steps. Crawling is Googlebot fetching a URL. Indexing is Google storing that page so it can appear in results. A Disallow line in robots.txt stops the first step. A noindex rule stops the second.
Google is direct about this on its robots.txt introduction: robots.txt is "used mainly to avoid overloading your site with requests" and "it is not a mechanism for keeping a web page out of Google." For that, the same page says to "block indexing with noindex or password-protect the page."
robots.txt Disallow | noindex (meta tag or X-Robots-Tag) | |
|---|---|---|
| What it stops | Crawling | Indexing |
| Where it lives | One file at /robots.txt | In the page's <head> or in the HTTP response header |
| Can the URL still show in Google? | Yes, if other pages link to it, with no description | No, once Google recrawls and sees the rule |
| Does Google need to fetch the page? | No, that is the point | Yes, or it never sees the rule |
| Works on PDFs and images? | Blocks fetching; Google says do not use it to hide PDFs | Yes, through the X-Robots-Tag header |
| Best for | Saving crawl load on URLs nobody needs fetched | Keeping a page that must stay reachable out of results |
Source: Google Search Central, Introduction to robots.txt and Block Search indexing with noindex, read November 2026.
Why doesn't blocking a page in robots.txt remove it from Google?
Because Google can index a URL without ever crawling it. If other sites or your own pages link to /private/report/, Google knows the URL exists. A disallow only means it cannot read the content. Google's robots.txt guide says a disallowed page "can still be indexed if linked to from other sites," and that such a result "won't have a description."
That is the result people find confusing: their page title or URL shows up with a note that no information is available, even though robots.txt "blocks" it.
The bigger trap is combining the two. Google's noindex documentation warns that for noindex to work, "the page or resource must not be blocked by a robots.txt file." If it is, "the crawler will never see the noindex rule, and the page can still appear in search results." MDN's X-Robots-Tag reference says the same for headers: indexing rules "won't be discovered or applied if paths are blocked from being crawled."
So a page with both a disallow and a noindex is effectively a page with only a disallow. The noindex is dead weight.
One more rule that still circulates in old tutorials: putting Noindex: /path/ inside robots.txt. Google's noindex page states that "specifying the noindex rule in the robots.txt file is not supported by Google." Delete those lines if you find them.
Should I use noindex or robots.txt for each kind of page?
Pick by what you actually want: no fetching, no listing in results, or no access at all. Here is how that plays out for the pages small sites usually ask about.
| Page or URL type | Use | Why |
|---|---|---|
| Thank you, order confirmation, internal search results | noindex | Visitors still need to reach them; you only want them out of results. |
| A page already in Google that you want gone | noindex, robots.txt left open | Google has to recrawl to see the rule. Blocking it freezes the old listing. |
PDFs, downloads, other files with no <head> | X-Robots-Tag: noindex header | Files cannot carry a meta tag; the header does the same job. |
| Staging site or preview deploy | Password protection, plus noindex | Anyone with the link can read an unprotected page. A password keeps both people and crawlers out. |
| Admin, account and cart URLs that only make sense when signed in | robots.txt Disallow (plus authentication) | No value in Googlebot fetching them, and login already keeps the content private. |
| Endless filter or calendar URL combinations | robots.txt Disallow, or a canonical | The goal is to stop crawl waste. See the canonical guide for duplicates you want consolidated. |
| Anything truly confidential | Authentication, not either rule | Both rules are public instructions to polite crawlers; neither stops a person. |
Source: recommendations follow Google Search Central's robots.txt and noindex guides, read November 2026.
For duplicate pages on your own site, a canonical is usually the better tool than either option. The canonical tags guide covers when to use one, and redirects are better still when nobody needs the old URL.
How do you add a noindex tag or X-Robots-Tag header?
For an HTML page, add one line to the <head>. This is the exact form from Google's documentation, and it applies to every search engine that supports it:
<meta name="robots" content="noindex">
To target only Google, use name="googlebot" instead. You can combine rules with commas, for example content="noindex, nofollow". Google notes that "some search engines might interpret the noindex rule differently," so if Bing traffic matters, check its results too.
For files, or when you would rather not edit templates, send the rule as a response header:
X-Robots-Tag: noindex
MDN documents a per-bot form, X-Robots-Tag: googlebot: noindex, and notes that when rules conflict, "the more restrictive rule applies."
On Netlify
Put a plain text file named _headers in your publish directory (the folder that gets deployed, not the repo root, if you have a build step):
/thank-you/*
X-Robots-Tag: noindex
/downloads/*
X-Robots-Tag: noindex
Or the same thing in netlify.toml:
[[headers]]
for = "/downloads/*"
[headers.values]
X-Robots-Tag = "noindex"
Two catches from Netlify's headers docs: custom headers "apply only to files Netlify serves from our own backing store," so pages rendered by a function, edge function or proxy need to set the header in that code. And header rules "are global for all builds and cannot be scoped for specific branches or deploy contexts" without a build step that copies a different _headers file per context.
On Vercel and Netlify previews
Both hosts already add X-Robots-Tag: noindex to some non-production URLs. Vercel adds it to preview deployments and to production deployments opened through their unique deployment URL, but not to a preview served from a custom domain you assigned to a branch, such as staging.example.com. A Netlify staff answer in its support forum (2021) says deploy previews and deploy-specific URLs get the header, while branch deploy URLs did not. That branch domain is the one to check by hand.
How do you remove a page that is already in Google?
Order matters here, and most mistakes come from doing step 3 first.
- Make sure robots.txt allows the URL. Remove any
Disallowline that covers it, even temporarily. - Add
noindexwith the meta tag or the X-Robots-Tag header, and deploy. - Confirm the live response carries the rule (the next section shows how). A tag sitting in a template that never ships does nothing.
- Ask Google to recrawl. Google says "it may take months for Googlebot to revisit a page," and points to the URL Inspection tool in Search Console to request a crawl sooner.
- Wait until the page is gone from results. Search for the exact URL or check URL Inspection, which reports whether the page is indexed.
- Only then, if you also want to stop crawling, add the disallow. Leave the noindex in place in case the disallow is ever removed.
If the page should not exist at all, deleting it so it returns 404 or 410 is another route, and if it moved, a 301 redirect to the new URL is better than either rule. The 404 guide covers which missing pages are worth redirecting.
How do you check what a page is actually telling Google?
Check the live URL, not your source files. A CMS plugin, a host default or a stale build can all send something different from what you think you deployed. Three quick commands cover it:
curl -s https://example.com/robots.txt
curl -sI https://example.com/thank-you/ | grep -i x-robots-tag
curl -s https://example.com/thank-you/ | grep -io '<meta[^>]*robots[^>]*>'
For more than a couple of URLs, this short Python script reads robots.txt, the X-Robots-Tag header and the meta robots tag for each URL and flags the disallow plus noindex conflict. It uses only the standard library, so it runs anywhere Python 3 is installed:
#!/usr/bin/env python3
"""Report robots.txt, meta robots and X-Robots-Tag for each URL."""
import re, sys, urllib.request, urllib.robotparser
from urllib.parse import urlsplit
UA = "Googlebot"
def check(url):
parts = urlsplit(url)
rp = urllib.robotparser.RobotFileParser(f"{parts.scheme}://{parts.netloc}/robots.txt")
rp.read()
blocked = not rp.can_fetch(UA, url)
req = urllib.request.Request(url, headers={"User-Agent": "index-check/1.0"})
try:
resp = urllib.request.urlopen(req, timeout=15)
except urllib.error.HTTPError as e:
resp = e
status = resp.status if hasattr(resp, "status") else resp.code
header = ", ".join(resp.headers.get_all("X-Robots-Tag") or [])
body = resp.read(500_000).decode("utf-8", "replace")
meta = ", ".join(re.findall(
r'<meta[^>]+name=["\'](?:robots|googlebot)["\'][^>]*content=["\']([^"\']*)', body, re.I))
rules = {r.strip().split(":")[-1].strip() for r in (header + "," + meta).lower().split(",")}
noindex = bool(rules & {"noindex", "none"})
if status >= 400:
verdict = f"returns {status}, so check that the error is intended"
elif blocked and noindex:
verdict = "CONFLICT: robots.txt blocks crawling, so Google never sees the noindex"
elif blocked:
verdict = "blocked from crawling, but the URL can still be indexed from links"
elif noindex:
verdict = "noindex will be seen and honored once Google recrawls"
else:
verdict = "indexable"
print(f"{url}\n status {status} | robots.txt blocked: {blocked} | "
f"X-Robots-Tag: {header or '-'} | meta: {meta or '-'}\n {verdict}")
for u in sys.argv[1:]:
check(u)
Run it with any number of URLs:
python3 check_index.py https://example.com/ https://example.com/thank-you/ https://example.com/downloads/guide.pdf
Tested in November 2026 on Python 3.13 against a local server with a disallowed folder, a noindexed page, a PDF sent with X-Robots-Tag: googlebot: noindex and a missing page; it reported each case correctly. Its meta tag pattern expects name before content, which is how almost every CMS writes it. It checks rules as written, not what Google decided, so use URL Inspection in Search Console for the final word on a specific page.
A full crawl catches the same problems across a whole site, along with related ones such as a noindexed page that is still listed in your XML sitemap. That exact finding appears in the CrawlKind sample audit, and the website audit checklist lists what else to check in the same pass.
What mistakes make noindex or robots.txt backfire?
- Disallow plus noindex on the same URL. The most common one. The disallow wins by hiding the noindex, and the page can stay listed.
- A staging robots.txt shipped to production.
Disallow: /on a live site stops Google from crawling everything. Check robots.txt after every launch or host move. - A noindex left on after launch. Many builders and CMSs have a "discourage search engines" switch that adds a site-wide noindex. It is easy to forget once the site goes live.
Noindex:lines in robots.txt. Google does not support them, so they protect nothing.- Blocking CSS or JavaScript files. Google's robots.txt guide says not to block resources if their absence makes the page "harder for Google's crawler to understand."
- Using either rule as security. robots.txt is public and lists exactly the paths you consider sensitive. Put private content behind a login.
Sources
- Google Search Central: Block Search indexing with noindex
- Google Search Central: Introduction to robots.txt
- MDN: X-Robots-Tag header
- Netlify Docs: Custom headers
- Vercel: Are preview deployments indexed by search engines?
- Netlify Support Forums: X-Robots-Tag on deploy previews (2021)
Frequently asked questions
Can I use noindex and robots.txt disallow on the same page?
You can, but it defeats the noindex. Google has to crawl a page to read its noindex rule, and a disallow stops that crawl. Google's documentation says a blocked page can still appear in results. Use noindex alone, and add the disallow only after the page has left the index.
Does Google still support noindex in robots.txt?
No. Google's noindex documentation states that a noindex rule in robots.txt is not supported. Lines such as Noindex: /private/ in robots.txt are ignored. Use a robots meta tag in the page or an X-Robots-Tag HTTP header instead, and keep the URL crawlable.
How long does it take for a noindexed page to leave Google?
It depends on when Googlebot recrawls the page. Google says that can take months for some pages. Requesting indexing through the URL Inspection tool in Search Console usually speeds it up. Until the recrawl happens, the old listing can stay in results.
Why does Search Console say a page is indexed though blocked by robots.txt?
Google found the URL through links and indexed it without crawling, because the disallow stopped it from reading the content. If you want the page out of results, remove the disallow for that URL and add noindex. If you want it indexed, remove the disallow and let Google crawl it.
How do I noindex a PDF or image?
Files have no HTML head, so send an X-Robots-Tag: noindex HTTP response header with them. On Netlify that is a _headers rule or a [[headers]] block in netlify.toml for the file path. Keep the files crawlable so Google can see the header on its next fetch.
Does noindex stop people from seeing a page?
No. noindex only asks search engines to leave the page out of results. Anyone with the link can still open it, and robots.txt is a public file anyone can read. For anything private, such as a staging site or client data, use password protection or a login.
Audit your site with your AI coding agent
CrawlKind is a website audit and fix kit for Claude Code: a full crawl, a prioritized findings report, and proposed fixes you review before anything changes. $49 once.