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.
Disallow: /thank-you/ and the ignored Noindex: line. 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.
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:
- 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.
- Remove or narrow that
Disallowline. If the rule covers a whole folder you still want blocked, add anAllow:line for this one path. Google usually caches robots.txt for up to 24 hours, per its spec, so the change isn’t instant. - 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.
- 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.
- Leave the page crawlable. Once it drops out, don’t block it again. A fresh
Disallowhides 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.
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.
