Skip to content
Devtoolry
Web Development

Noindex vs robots.txt Disallow vs Canonical: Which One to Use

Disallow stops crawling, noindex stops indexing and canonical merges duplicates. Learn which one fits each case, why mixing them backfires and how to check.

Photo of Avinash KoriBy Avinash KoriPublished 5 min read

Robots.txt Disallow stops crawling, noindex stops indexing, and rel=canonical points duplicate pages to one main URL

You have a page you do not want in Google. Maybe it is a thank-you page, a filtered product listing, a staging copy or a printer-friendly duplicate. There are three common tools for the job: a Disallow rule in robots.txt, a noindex directive and a rel="canonical" link. They sound interchangeable. They are not, and choosing the wrong one is one of the most common reasons a page stays in search results long after someone tried to remove it.

This guide explains what each one really does, when to use which, and the combinations that cancel each other out.

The short answer

You want toUseWhy
Remove a page from search resultsnoindex (meta tag or header)It is the only one that tells search engines not to index the page
Stop bots wasting time on endless URLsrobots.txt DisallowIt stops crawling, which saves crawl budget
Keep one version of near-identical pagesrel="canonical"It merges duplicates into the URL you choose
Remove a page for good404 or 410 statusA deleted page drops out by itself
Keep private content privatePassword or loginNone of the three is a security measure

The key idea: robots.txt controls crawling, noindex controls indexing, canonical controls which duplicate is shown. They answer different questions.

robots.txt Disallow: stop crawling

A rule such as this tells compliant crawlers not to fetch matching URLs:

Output
User-agent: *
Disallow: /search
Disallow: /cart

What it does not do is remove the URL from the index. If other pages link to a disallowed URL, Google can still index the address without ever reading it. It then shows up in Search Console as "Indexed, though blocked by robots.txt", and in results with no description, or with the message that no information is available for the page.

Google stopped supporting noindex lines inside robots.txt on 1 September 2019, so there is no way to deindex through robots.txt itself.

Use Disallow when the problem is crawling, not indexing:

  • Internal search result pages and filter combinations that create thousands of URLs.
  • Cart, checkout and account pages that have no value to a crawler.
  • Endless calendars and parameter URLs that trap bots.

Do not use it to hide CSS, JavaScript or images the page needs to render. Google renders pages like a browser, and a blocked stylesheet can make your page look broken to it. The Robots.txt Checker tests a live file the way Google reads it and lists blocked resources. More patterns are in our robots.txt examples.

noindex: stop indexing

noindex is a directive, not a hint: when Google crawls a page and sees it, the page is dropped from results. You can set it two ways.

In the HTML head:

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

Or as an HTTP response header, which also works for PDFs, images and other non-HTML files:

Output
X-Robots-Tag: noindex

Use noindex for pages people need but searchers do not: thank-you and confirmation pages, thin tag archives, internal campaign landing pages, and staging sites that are reachable on the internet.

Two things to know. First, the page must be crawlable for noindex to work, because Google has to fetch the page to read the tag. Second, removal is not instant: the page drops out the next time Google crawls it, which can take days or weeks for rarely visited URLs. For an urgent case, Search Console's Removals tool hides a URL for about six months while the noindex takes effect.

Over a long time Google also crawls noindex pages less often, and links on them may stop being followed. Do not rely on a noindex page as an important hub for internal links.

rel=canonical: merge duplicates

A canonical link says "this page is a copy; the main version is over there":

HTML
<link rel="canonical" href="https://example.com/shoes/red-runner">

Use it when several URLs show the same or very similar content and you want one of them in results: product pages reachable through several categories, URLs with tracking parameters, sorted or paginated variants, and syndicated copies of your articles.

A canonical is a hint, not a directive. Google weighs it with other signals (internal links, the sitemap, redirects, HTTPS) and may choose a different URL if the signals disagree. Ranking signals such as links are consolidated on the chosen URL, which is the advantage over noindex: the duplicate's value is not thrown away.

Rules that keep canonicals working: point to a URL that returns 200, is indexable and is not redirected; use absolute URLs; and give every indexable page a self-referencing canonical. The Canonical & Noindex Checker checks the tag, the Link header, robots meta, X-Robots-Tag and robots.txt for one URL and gives a single indexing verdict.

Combinations that backfire

Disallow plus noindex. This is the most common mistake. The page is blocked in robots.txt, so Google never fetches it and never sees the noindex. The URL can stay indexed indefinitely. Fix: remove the Disallow until the page has dropped out, then add it back if crawling is still a problem.

Canonical plus noindex on the same page. One signal says "index the other URL instead", the other says "do not index this". Google has said this sends mixed signals. Pick one: canonical if the page is a duplicate, noindex if it should not be in search at all.

Canonical to a blocked or noindexed page. If the target cannot be crawled or is set to noindex, the canonical points to nothing usable and Google will likely ignore it. Our SEO issues library lists the related problems and fixes.

Disallow to remove an indexed page. Blocking an already indexed URL freezes it in the index with no description. Use noindex or a 404 first, and block only after it is gone.

Which one for common pages

  • Thank-you page after a form: noindex.
  • Internal site search results: Disallow (and noindex if they are already indexed, removing the Disallow until they drop out).
  • Product in two categories at two URLs: canonical to the main URL.
  • Filter and sort parameters on a shop: canonical to the unfiltered category for light variants; Disallow for crawl traps with many combinations.
  • Staging site: password protection. noindex as a backup, never only robots.txt.
  • Discontinued product with no replacement: 404 or 410; with a close replacement, a 301 redirect.
  • PDF you do not want in search: X-Robots-Tag: noindex header.

How to check what Google sees

  1. Run the URL through the Canonical & Noindex Checker for an indexing verdict.
  2. Use the Googlebot Simulator to see whether bots get a different response from visitors.
  3. In Search Console, URL Inspection shows the canonical Google chose and whether crawling is allowed. The Page indexing report groups URLs by reason, including "Excluded by noindex tag" and "Indexed, though blocked by robots.txt".
  4. For a whole site, the Site Audit Tool crawls up to 500 pages and lists noindexed, canonicalised and blocked URLs, so you can spot a template that applies the wrong rule everywhere.

Summary

Disallow saves crawl time but does not remove pages. Noindex removes pages but only if bots can read it. Canonical merges duplicates and keeps their value, but Google treats it as a suggestion. Use one per page, matched to the problem you actually have, and check the result in Search Console a few weeks later.

Photo of Avinash Kori

Written by

Avinash Kori

Founder of Devtoolry

Avinash is a full-stack web developer from Surat, India, with eight years of experience in PHP, Laravel and Angular. He built Devtoolry so developers can solve everyday problems quickly with free tools that run entirely in the browser, and writes practical guides on the formats, encodings and techniques behind them.

Connect on LinkedIn

Try it yourself

The free tools used in this article. They run in your browser, so nothing you paste is uploaded.