Guides/Robots.txt vs. Noindex vs. Canonical
Technical

Robots.txt vs. Noindex vs. Canonical

These three get confused constantly, and mixing them up can accidentally keep pages indexed you meant to hide, or hide pages you meant to keep. Here's exactly what each one controls.

Bartu Cavusoglu

Founder, Vazagency · Runs reputation recovery and SEO campaigns for businesses across 35+ industries.

10 min read·Updated July 2026

Robots.txt, the noindex tag, and the canonical tag are three of the most commonly used tools in technical SEO, and three of the most commonly confused. They sound like they're all doing roughly the same job — "keep this page out of search results" — but they actually control three distinct things: crawling, indexing, and duplicate consolidation. Mixing them up doesn't just fail to fix the problem, it frequently creates a new one. This guide lays out exactly what each does, precisely, with no hand-waving.

Robots.txt: controls crawling, not indexing

A robots.txt file is a plain text file at the root of your domain (yoursite.com/robots.txt) that gives crawlers instructions about which parts of the site they're allowed to fetch. A rule like:

A basic disallow rule

User-agent: *
Disallow: /admin/

tells all crawlers not to fetch anything under /admin/. This is a crawling instruction only. It does not, by itself, prevent a URL from appearing in search results. If other pages (on your site or elsewhere) link to a disallowed URL, Google can still index that URL as a bare address — sometimes with a title pulled from the linking page's anchor text — while never reading its actual content, because it's forbidden from fetching it. This is exactly why disallowed pages sometimes still show up in search results with no description.

Robots.txt is also purely voluntary — it works because well-behaved crawlers choose to respect it, not because it technically blocks access. And critically, the file itself is public and readable by anyone, so it should never be treated as a way to keep something private or secret.

Noindex: controls indexing, but requires crawling to work

The noindex directive — usually a meta tag in the page's head (<meta name="robots" content="noindex" />) or an equivalent HTTP header (X-Robots-Tag) for non-HTML files — tells a search engine directly: don't include this page in search results. This is a real, direct indexing instruction, unlike robots.txt.

The catch is the mechanism itself: the noindex instruction lives inside the page's content (or its HTTP response headers), which means the crawler has to actually be able to fetch the page to see it. A page that's noindexed but also blocked from crawling in robots.txt puts the crawler in an impossible position — it's told not to fetch the page, so it never sees the instruction telling it not to index the page. Result: the noindex tag is silently ignored, and the page can still be indexed via other signals, like inbound links.

The correct sequence for removing a page from the index

If you want a page genuinely out of search results: add the noindex tag, and make sure the page is not blocked in robots.txt, so the crawler can reach the page, read the noindex tag, and act on it. Once you've confirmed (via Search Console) that the page has actually been removed from the index, you can consider blocking it in robots.txt afterward if you also want to stop future crawl attempts — but not before.

Canonical: a consolidation hint, not an exclusion

A canonical tag (<link rel="canonical" href="..." />) addresses a different problem entirely: multiple URLs serving the same or very similar content. It doesn't say "don't index this" — it says "if you're going to index one version of this content, index this specific URL as the primary one." Both the canonical and non-canonical URLs typically remain crawlable and can both still get visited by crawlers; the tag only affects which one search engines treat as the authoritative version for indexing and ranking purposes.

It's also explicitly a hint rather than a directive — search engines weigh it alongside other signals and can choose a different canonical if the declared one doesn't match their own assessment. See canonical tags, explained for the full mechanics.

Side by side

  • Robots.txt disallow — controls whether a crawler may fetch a URL at all. Does not guarantee exclusion from search results. Publicly readable. No effect on pages already indexed before the rule was added.
  • Noindex — controls whether a specific, crawlable page is included in the index. Requires the page to be crawlable to take effect. The correct tool for "keep this exact page out of search results."
  • Canonical — controls which of several similar/duplicate URLs is treated as authoritative. Does not block crawling or guarantee exclusion of the alternates. The correct tool for "these are duplicates, here's the one that should win."

Which one do you actually need?

  1. Keep crawlers out of an entire section (staging environment, internal search results, admin area) with no concern about pages already indexed: robots.txt disallow. Pair with actual authentication if the content is sensitive, since robots.txt is not access control.
  2. Keep one specific, real page out of search results while still letting it be crawled and pass link value onward: noindex, and confirm it isn't also blocked by robots.txt.
  3. Consolidate near-duplicate or parameterized versions of the same content into one indexable URL: canonical tag, pointing every variant at the preferred version.
  4. Permanently retire a URL and merge its value into a different, real page: a 301 redirect, which none of the above three tools actually is.

For a walk-through of how to fix duplicate-content situations specifically using canonical tags (and when noindex or a redirect is the better fit instead), see how to fix duplicate content issues. And if the concern is specifically about AI crawlers rather than classic search indexing, see how to check if AI bots can crawl your site, since AI crawlers don't uniformly handle noindex the way Google does.

Frequently asked questions

If I block a page in robots.txt, will it definitely disappear from Google's search results?
Not necessarily, and this surprises a lot of people. Robots.txt only controls crawling — whether Googlebot is allowed to fetch the page's content. It does not control indexing directly. If other pages link to that blocked URL, Google can still index the URL itself (as an address with a title, sometimes pulled from those inbound links) even though it never reads the page's content, because it's not allowed to. You'll often see this show up in search results as a URL with the note that no description is available. To actually keep a page out of the index, use a noindex tag instead, and make sure the page is crawlable so Google can see that tag.
Why can't I just use robots.txt AND a noindex tag together to be extra sure?
Because they conflict with each other, and the outcome is worse than using either one correctly on its own. If a page is disallowed in robots.txt, Google's crawler is instructed never to fetch its content — which means it never sees the noindex tag sitting inside that content, since the tag itself is inside the page. The noindex instruction is simply never read. This is one of the most common real-world SEO mistakes: a developer blocks a staging or admin section in robots.txt, someone separately adds noindex tags for extra safety, and the noindex tags do nothing because the crawler is blocked before it ever reaches them.
Does a canonical tag remove a page from search results the way noindex does?
No. A canonical tag is a consolidation signal — it tells Google which of several similar or duplicate URLs should be treated as the primary, indexable one. It doesn't guarantee the non-canonical URL is excluded, and Google can override your declared canonical if other signals point elsewhere. If your actual goal is guaranteeing a specific page never appears in search results, use noindex, not a canonical tag pointed elsewhere.
Is robots.txt a security tool for hiding pages I don't want the public to see?
No, and this is a genuinely risky misunderstanding. A robots.txt file is a plain text file published at a public, predictable URL on every website, and anyone — not just search engines — can read it directly. Listing a sensitive URL there specifically to keep it 'hidden' actually advertises its exact location to anyone who checks. If something needs to stay private, use authentication (a login or password) or keep it off the public web entirely, not a robots.txt disallow rule.
Do AI crawlers like GPTBot respect noindex tags the same way Googlebot does?
This varies and is less standardized than the classic search engine world. Robots.txt disallow rules are generally respected by the major, identifiable AI crawlers that publish their policies. Noindex meta tags were designed specifically for search engine indexing behavior, and how (or whether) each AI platform's crawler interprets them for its own purposes isn't uniformly documented the way Google's handling of noindex is. If you need to keep specific content away from AI crawlers, controlling crawl access through robots.txt is the more reliable lever than relying on a noindex tag to be honored the same way.

Put this into practice

More guides

Want this handled for you?

We build the SEO foundation and handle the ongoing work — no long-term contract, no guaranteed-rankings sales pitch.