Robots.txt vs Noindex: How to Keep a Page Out of Google

Robots.txt controls crawling, noindex controls indexing. Learn which one removes a page from Google, with copy-paste examples for WordPress and PDFs.

Robots.txt vs Noindex – Techono guide cover

Quick answer: To keep a page out of Google, add a noindex tag and let Google crawl the page so it can see the tag. A robots.txt block only stops crawling. A blocked page can still appear in results, usually without a description. For private content, use a password.

The difference, in short

  • robots.txt Disallow: “Do not visit this URL.” Controls crawling. Does not remove a page from search.
  • noindex: “You can visit, but do not show this page in results.” Controls indexing.
  • Password: nobody, including search engines, can see the content.

How to add noindex

In the page HTML

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

In WordPress, an SEO plugin adds this for you with a checkbox on each page.

For PDFs and other files

Files have no HTML, so send an HTTP header instead. On Apache or LiteSpeed, add this to .htaccess:

<FilesMatch "\.pdf$">
  Header set X-Robots-Tag "noindex"
</FilesMatch>

For the whole site

WordPress has a checkbox in Settings → Reading: “Discourage search engines from indexing this site”. It adds noindex to every page. Use it for staging sites and sites that are not ready yet, and remember to turn it off at launch.

The most common mistake

People add noindex and block the page in robots.txt. Google then cannot crawl the page, so it never sees the noindex. The page can stay in results. Remove the robots.txt block until Google has dropped the page.

Also: Google does not support Noindex: lines inside robots.txt. They are ignored.

When robots.txt is the right tool

  • Search result pages and filters that create endless URLs
  • Admin areas, like /wp-admin/
  • Large files that waste crawling
  • AI crawlers you do not want, see our AI crawlers guide

Need a page gone fast?

Add noindex (or delete the page so it returns 404 or 410). Then use the Removals tool in Google Search Console. It hides the page for about six months while Google processes your change.

Sources

Jonathan

More from the SimpliCloud Blog

XML Sitemaps: What to Include and How to Fix Common Errors

XML Sitemaps: What to Include and How to Fix Common Errors

What belongs in an XML sitemap, the 50,000 URL limit, which fields Google ignores, and how to fix redirects, 404s and noindex pages in your sitemap.

How to Write Title Tags and Meta Descriptions That Get Clicks

How to Write Title Tags and Meta Descriptions That Get Clicks

A simple formula for page titles and meta descriptions, good and bad examples, and why Google sometimes rewrites them.

Robots.txt vs Noindex: How to Keep a Page Out of Google

Robots.txt vs Noindex: How to Keep a Page Out of Google

Robots.txt controls crawling, noindex controls indexing. Learn which one removes a page from Google, with copy-paste examples for WordPress and PDFs.

Need a Tool We Don’t Have?

Tell us what you check on your sites every week. The most-requested tools get built first.