Technical SEO

Robots.txt noindex: why Google ignores it, and what to use instead

Google stopped reading noindex in robots.txt in 2019. Use a robots meta tag or X-Robots-Tag header, and don't block the page you want removed.

// in this article

You can’t noindex a page with robots.txt. Google stopped honoring a noindex line in robots.txt on September 1, 2019, and Bing says it never supported one, so to keep a page out of search results you put the noindex rule on the page itself, in a robots meta tag or an X-Robots-Tag HTTP header, and leave the page crawlable.

That last part is where most sites go wrong. A Disallow rule stops search engines from fetching the page, which means they never see the noindex tag on it, and the URL can stay in Google anyway. Below is why, what to use for each kind of file, and how to fix a page that’s both blocked and noindexed.

Why a noindex line in robots.txt does nothing

Some sites used to add lines like Noindex: /thank-you/ to robots.txt. Google never documented that rule, and in a July 2019 post it announced it was “retiring all code that handles unsupported and unpublished rules (such as noindex)” from September 1 that year. Bing’s Frédéric Dubut replied the same day that “the undocumented noindex directive never worked for Bing.”

Today Google’s robots.txt spec lists four supported fields: user-agent, allow, disallow and sitemap. Anything else is ignored without an error, so a Noindex: line just sits in the file doing nothing.

The deeper reason is that robots.txt was never an indexing tool. Google’s introduction to robots.txt says it tells crawlers “which URLs the crawler can access on your site” and is “used mainly to avoid overloading your site with requests.” It also warns that Google “might still find and index a disallowed URL if it is linked from other places on the web.” When that happens, the result shows up with no description, because Google never read the page.

step_01 Googlebot reads robots.txt It finds Disallow: /thank-you/ and the ignored Noindex: line.
step_02 It skips the page The HTML is never fetched, so any noindex tag inside it is never seen. tag unseen
step_03 Links still point to it A menu, an email or another site links to the URL, so Google knows it exists.
step_04 The URL can be indexed It can appear in results with no description, the opposite of what you wanted.
fig 1 · what happens to a page you try to noindex through robots.txt, per google's robots.txt and block indexing docs

What to use instead

Google’s block indexing guide gives two ways to say noindex, and its 2019 post adds a few other ways to keep a page out. Pick by what the URL is.

Robots meta tag One line in the page's head. For any HTML page you can edit. most pages
X-Robots-Tag header Set on the server. Works for PDFs, images and video, which have no head. files
404 or 410 status Tells search engines the page no longer exists. deleted pages
Login or password Crawlers can't get past it, so there's nothing to index. private content
fig 2 · four ways to keep a url out of google, from google's 2019 robots.txt post and block indexing guide

The robots meta tag

Put this inside the <head> of the page:

<meta name="robots" content="noindex">

Use name="googlebot" instead of robots if you only want to keep the page out of Google. Good candidates are thank-you pages, internal search results, cart and account pages, and thin tag archives.

On WordPress, most SEO plugins add a per-page setting that writes this tag for you, so check your plugin’s docs before editing theme files. Also know what the “Discourage search engines from indexing this site” box does. Since WordPress 5.3 it no longer adds Disallow: / to robots.txt; it prints <meta name='robots' content='noindex,nofollow' /> on every page instead. WordPress made that change precisely because a robots.txt block can still leave a site listed. If a live site has dropped out of Google, that box is one of the first things to check.

The X-Robots-Tag header

A PDF has no <head>, so the rule goes in the HTTP response. Say a made-up landscaping company in Austin posts PDF price sheets for each season and wants the service pages, not the PDFs, to rank. Google’s robots meta tag docs give these server rules.

Apache (.htaccess):

<Files ~ "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

NGINX:

location ~* \.pdf$ {
  add_header X-Robots-Tag "noindex, nofollow";
}

Check it worked with curl -I https://example.com/price-sheet.pdf and look for the X-Robots-Tag line in the response. WordPress can’t set this header for files your web server sends directly, as its 5.3 note points out, so on managed hosting you may need to ask your host to add it.

If a page ends up with two different rules (say, a plugin adds index and your theme adds noindex), Google’s docs say “the more restrictive rule applies,” so the noindex wins.

A page that’s blocked and noindexed: fix it in this order

This is the case behind the “Indexed, though blocked by robots.txt” status in the Page indexing report. To get the URL out of Google:

  1. Find the rule that blocks it. Run the URL through URL Inspection, or test it against your file with one of the methods in our robots.txt tester guide.
  2. Remove or narrow that Disallow line. If the rule covers a whole folder you still want blocked, add an Allow: line for this one path. Google usually caches robots.txt for up to 24 hours, per its spec, so the change isn’t instant.
  3. Confirm the noindex is really there. In URL Inspection, run a live test and view the HTML Googlebot received. The tag must be in that HTML (or the header in the response), not added later by a script that fails to run.
  4. Ask Google to recrawl. Press “Request indexing” on the same URL. Google’s guide warns that “it may take months for Googlebot to revisit a page” if you don’t, depending on how important it looks.
  5. Leave the page crawlable. Once it drops out, don’t block it again. A fresh Disallow hides the noindex once more, and links can bring the URL back.

Step 2 is the one that matters most. Every other step assumes Googlebot can fetch the page, and while the block is in place nothing you do to the page itself has any effect. If the page has to vanish from results today, file a temporary request in the removals tool while you wait for the recrawl.

✕ Blocked and noindexed
robots.txt: Disallow: /price-sheets/
robots.txt: Noindex: /price-sheets/
header: X-Robots-Tag: noindex (never read)
result: pdf can stay in google, no description
✓ Crawlable and noindexed
robots.txt: no rule for /price-sheets/
robots.txt: Noindex line deleted
header: X-Robots-Tag: noindex (read on crawl)
result: pdf drops out after the recrawl
fig 3 · the made-up landscaper's price sheet pdfs set up two ways

When robots.txt is still the right tool

Robots.txt is for controlling what gets crawled, not what gets listed. Use Disallow when crawlers waste time on URLs nobody needs, such as endless filter and sort combinations or internal search result pages, and when you don’t mind those URLs occasionally showing up bare. It’s also where you opt out of specific bots, which is covered in our guide to blocking AI crawlers.

If you need both (a URL that shouldn’t be crawled heavily and shouldn’t be listed), do it in two stages: noindex it first, wait until it has left the index, and only then think about blocking. For most small business sites, the noindex alone is enough, and our list of technical SEO issues covers what else to check when the wrong pages show up in Google.

FAQ

Does noindex affect SEO?

Only for the page that has it. Google’s definition of noindex is “Do not show this page, media, or resource in search results,” so a noindexed page can’t rank, but the rest of your site is judged on its own pages.

What is the difference between noindex and nofollow?

Noindex keeps the page out of search results. Nofollow, used in the robots meta tag, tells crawlers “Do not follow the links on this page.” You can combine them as noindex, nofollow, which Google also accepts as the single value none, per its robots meta tag docs.

How do I check if robots.txt is working?

Open the robots.txt report in Search Console to see whether Google fetched your file, then run important URLs through URL Inspection to see if they’re blocked. The full process, including testing a rule before you publish it, is in our robots.txt tester guide.

Let Google crawl the page you want gone

The rule to remember is backwards from what it sounds like: to remove a page from search, you have to let search engines read it. Delete any Noindex: line from robots.txt, put noindex in the page’s meta tag or the file’s X-Robots-Tag header, make sure no Disallow rule covers the URL, and request a recrawl in URL Inspection.

Portrait of Liam Fraser
// written byLiam FraserSEO specialist with 3 years of experience. Liam writes about what works in local, technical and AI search.About SerpSurfers →