⚙️ Technical SEO · Beginner · 18 min

Indexing under control: robots.txt, noindex, canonical and XML sitemaps explained

Before a page can rank, two completely separate things have to happen. A search engine has to crawl it (fetch the content) and then index it (store it as a candidate for search results). These are not the same step, and almost every indexing problem you will ever face comes from treating them as if they were. Four tools let you steer the process: robots.txt, the noindex directive, the canonical tag and the XML sitemap. Each one acts on a different stage. Robots.txt controls crawling. Noindex controls indexing. Canonical resolves duplicates. The sitemap suggests what to discover. They are not interchangeable, and using the wrong one is how good pages disappear and bad pages refuse to leave.

This guide walks you through all four tools end to end: what each one does, exactly how to implement it, the worked examples you can copy, the pitfalls that catch even experienced SEOs, and how to verify everything in Google Search Console. It also covers the 2026 reality that the classic crawl-and-index model is no longer the whole story. AI engines like ChatGPT, Perplexity, Google AI Overviews, Gemini and Claude now read your site through their own crawlers, and robots.txt has quietly become the control panel for whether they can cite you at all. By the end you should be able to look at any URL and know, without guessing, which tool keeps it out of search and which one lets it shine.

Key takeaways
  • Crawling and indexing are different stages: robots.txt acts on crawling, noindex and canonical act on indexing, and the sitemap acts on discovery. Pick the tool that matches the stage you want to control.
  • robots.txt controls crawling, not indexing. A blocked URL can still appear in search results without a description if other sites link to it.
  • noindex is the only reliable way to keep a page out of the index, but the page must stay crawlable so Google can read the tag. Never combine it with a robots.txt Disallow.
  • Canonical is a hint, not a command, and it contradicts noindex. Reinforce your chosen canonical with consistent internal links and sitemap entries, and never put both directives on the same URL.
  • Put only indexable, canonical, 200-status URLs in your XML sitemap, keep <lastmod> honest, split files at 50,000 URLs, and verify everything in Search Console after each change.
  • In 2026, robots.txt also governs AI crawlers. Blocking search-oriented bots like OAI-SearchBot, PerplexityBot or Claude-SearchBot removes you from AI answers, so a page AI can't crawl is a page AI can't cite.

Crawling vs indexing: the distinction everything depends on

Crawling is when a bot like Googlebot requests your URL and downloads the HTML, just as a browser would. Indexing is the separate decision to store that page in the search engine's database so it can be returned in results. A page can be crawled but not indexed (Google fetched it and decided it wasn't worth keeping). And, counter-intuitively, a page can be indexed without ever being crawled (Google saw links to it and listed the URL even though it never read the content).

Hold onto this map, because each of the four tools plugs into exactly one stage:

  • robots.txt acts at the crawl stage. It can stop the fetch from ever happening.
  • noindex acts at the index stage. It tells Google not to store a page it has already fetched.
  • canonical acts at the index stage too. It consolidates several crawled URLs into one indexed entry.
  • XML sitemap acts before crawling. It is a discovery hint that nudges bots toward URLs worth fetching.

Once you internalise which stage each tool touches, the classic mistakes become obvious. You cannot use a crawl-stage tool (robots.txt) to fix an index-stage problem (a page showing in results), because by the time you block the crawl, Google can no longer read the very instruction that would remove the page. This single insight prevents the majority of indexing disasters.

robots.txt: controlling crawling, not indexing

The robots.txt file lives at the root of your domain (`example.com/robots.txt`) and tells crawlers which paths they may or may not fetch. Its real purpose is managing crawl load, keeping bots out of infinite filter URLs, internal search results, faceted navigation, or staging areas. It is not for hiding pages from search results. The file is read top to bottom and grouped by `User-agent`. A basic block looks like this:

```

User-agent: *

Disallow: /cart/

Disallow: /search

Allow: /search/help

```

The `*` targets every bot, `Disallow` blocks a path prefix, and `Allow` carves out an exception inside a blocked directory.

Here is the trap that snares everyone at least once: a URL blocked in robots.txt can still appear in Google's index if other sites link to it. Google won't fetch the content, so it shows the bare URL with no description, the dreaded "No information is available for this page" or "Indexed, though blocked by robots.txt" status. Robots.txt prevents *crawling*. It does not guarantee a page stays out of *search results*. If your goal is to keep a page out of Google, robots.txt is the wrong tool. You want noindex (next section).

Two rules that cost nothing and pay off forever. First, always reference your sitemap inside robots.txt with a line like `Sitemap: https://example.com/sitemap.xml` (it can sit anywhere in the file and is read by every major crawler). Second, never block resources Google needs to render the page, meaning CSS, JavaScript and key API endpoints. Blocking your `/assets/` or `/wp-content/` folders can make Google see a broken, half-rendered page and quietly hurt rankings. Robots.txt is a scalpel for crawl management, not a blunt instrument for hiding content.

When you genuinely want a page excluded from search results, use a noindex directive. There are two ways to deliver it. For standard HTML pages, place a meta tag in the `<head>`:

```

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

```

For non-HTML files (PDFs, images, downloads) or when you can't edit the HTML, send it as an HTTP response header from the server:

```

X-Robots-Tag: noindex

```

Unlike robots.txt, noindex is a strict instruction. Once Google crawls the page and reads the tag, it drops that page from the index entirely, regardless of how many sites link to it.

The catch, and it is the single most common indexing mistake in the world, is that Google has to crawl the page to read the noindex tag. So if you block a URL in robots.txt *and* add noindex, Googlebot never fetches the HTML, never sees the noindex, and the page can linger in the index indefinitely as a description-less listing. The two directives cancel each other out. Rule to memorise: a page you want deindexed must stay crawlable until Google has actually dropped it. Only afterward, if you also want to stop wasting crawl on it, may you add a robots.txt disallow.

Good candidates for noindex include thank-you and order-confirmation pages, internal search results, thin tag and date archives, paginated comment pages, staging URLs, and gated or login-only content you don't want surfacing. A useful variant is `content="noindex, follow"`, which keeps the page out of the index while still letting Google follow its links to pass authority onward. That comes in handy on paginated archives. Note that over time Google treats long-term noindexed pages as effectively `nofollow` too, so don't rely on a permanently noindexed page as a link conduit.

canonical: resolving duplicate and near-duplicate pages

The canonical tag tells Google which version of similar or duplicate pages you consider the master copy. It lives in the `<head>` and points (always with an absolute URL) at the preferred version:

```

<link rel="canonical" href="https://example.com/blue-widget">

```

It's essential whenever the same content is reachable through multiple URLs: tracking parameters (`?utm_source=...`), `http` vs `https`, `www` vs non-`www`, with and without a trailing slash, uppercase vs lowercase, or a product that appears under several categories. The ranking signals scattered across those duplicates then consolidate onto the single canonical URL instead of being diluted.

Crucially, canonical is a hint, not a command. Google weighs your declared canonical against internal links, redirects, sitemap entries and even content similarity, and if those signals conflict it may pick a different canonical than the one you stated. You'll see this in Search Console as "Google-selected canonical" differing from "User-declared canonical". To make the hint stick, get every other signal to agree: link internally to the canonical URL only, list only the canonical in your sitemap, redirect obvious duplicates where possible, and never point a canonical at a page that is itself noindexed, redirected, or returns an error.

A self-referencing canonical (a page pointing to itself) is good practice on all your main pages, because it removes ambiguity the moment parameters get appended to the URL. And do not mix canonical with noindex on the same page. Google's John Mueller clarified in 2024 that these are contradictory signals (one says "index this other URL instead", the other says "don't index at all") and you should pick exactly one. In 2026 Google is even less willing to guess your intent from messy signals, so clean, consistent directives win.

XML sitemaps: helping Google discover what matters

An XML sitemap is a machine-readable list of the URLs you want indexed. It doesn't *force* indexing. It speeds discovery, which is especially valuable for large sites, brand-new sites with few external links, frequently updated sections, or pages buried deep in your structure. A minimal entry looks like:

```

<url>

<loc>https://example.com/blue-widget</loc>

<lastmod>2026-05-14</lastmod>

</url>

```

Submit the sitemap in Google Search Console (Indexing → Sitemaps) and reference it in robots.txt so every crawler finds it.

The golden rule: include only indexable, canonical URLs that return a 200 status. A sitemap must never contain noindexed pages, redirects (3xx), error URLs (4xx/5xx), or non-canonical duplicates. Mixing those in sends conflicting signals, because you're telling Google "these matter, crawl them" while other directives say the opposite, and it wastes crawl budget. Each sitemap file is capped at 50,000 URLs and 50 MB uncompressed. Beyond that, split into multiple files listed in a sitemap index file, ideally segmented by content type (blog, products, categories). Segmenting pays off in Search Console, where you can see indexing rates per segment and spot exactly which content type is struggling.

Use the `<lastmod>` tag and keep it honest. Set it only when content meaningfully changes, because Google uses lastmod to prioritise recrawls but learns to ignore it on sites where it's clearly unreliable (e.g. every URL stamped with today's date). The `<priority>` and `<changefreq>` tags are largely ignored by Google, so don't waste effort on them. Finally, prefer a dynamically generated sitemap that your CMS rebuilds automatically on publish, edit and delete. A hand-maintained static file drifts out of sync within weeks and quietly reintroduces all the errors above.

Step-by-step: deindexing a page the right way

Say a thank-you page or an old landing page is showing up in Google and you want it gone. Follow this exact order, because the sequence is what prevents the page from getting stuck:

  1. Add the noindex directive to the page (`<meta name="robots" content="noindex">` or `X-Robots-Tag: noindex`).
  2. Leave the page crawlable, making sure no robots.txt rule blocks it. Google must be able to fetch it to read the tag.
  3. Remove it from your XML sitemap so you stop advertising it as a page to index.
  4. Optionally request faster removal: in Search Console use the Removals tool for an immediate (but temporary, ~6 month) hide, and/or use URL Inspection → Request indexing to push a fresh crawl.

Now wait. Google has to recrawl the page and process the noindex before the listing disappears, which can take days to a few weeks depending on how often it crawls your site. You can confirm it has happened in URL Inspection, which will report "Excluded by 'noindex' tag". Resist the urge to speed things up by blocking the URL in robots.txt. That is exactly the move that prevents the noindex from ever being seen and traps the page in limbo.

Only after the page is confirmed dropped from the index, and only if you also want to save crawl budget on a large set of such URLs, should you add a robots.txt disallow. For the opposite goal (getting an important new page indexed faster) the sequence is mirror-image: ensure it's crawlable, canonical and returns 200, add it to the sitemap, link to it internally from a strong page, then use URL Inspection → Request indexing. Search Console allows roughly 10 to 12 manual indexing requests per property per day, so reserve them for genuinely high-priority pages.

Choosing the right tool: a decision cheat sheet

Ask one question first: do you want to stop the page being crawled, or stop it being indexed? Map your answer:

  • Page should be reachable by users but NOT appear in Google → noindex, keep it crawlable.
  • Page should never be fetched at all (admin areas, infinite parameter URLs, faceted filters burning crawl budget) → robots.txt Disallow.
  • Two URLs serve the same content and both must stay accessible → canonical to nominate the master.
  • One URL has permanently replaced another → 301 redirect, which is cleaner than canonical when the old URL truly should go away.

Some combinations are safe and some are poison. Safe: noindex + crawlable; canonical + self-reference; sitemap listing only 200/canonical/indexable URLs. Poison: robots.txt Disallow + noindex (the noindex can't be read); canonical + noindex on the same URL (contradictory); a sitemap full of redirected or noindexed URLs (mixed signals). When in doubt, send one clear instruction per URL rather than layering several that may fight each other.

Implementing it with tools and your CMS

You rarely hand-edit these files on a real site. On WordPress, SEO plugins like Yoast SEO, Rank Math or All in One SEO expose per-page noindex toggles, automatic self-referencing canonicals, dynamic XML sitemaps, and an editable robots.txt, all without touching code. On a custom or headless stack (Next.js, Astro, etc.) you generate the sitemap programmatically and set canonical/robots meta in your page templates. On Shopify and most hosted platforms canonicals and sitemaps are auto-generated, with noindex controlled via theme settings or apps.

For auditing, a desktop crawler is indispensable. Screaming Frog SEO Spider and Sitebulb crawl your site exactly as Googlebot would and flag, in one view, every URL that is blocked, noindexed, non-canonical, orphaned, or sitting in a sitemap despite being non-indexable. Cloud platforms like Semrush and Ahrefs run scheduled Site Audits that surface the same issues over time and alert you when a deploy accidentally noindexes a section, which is a common and traffic-destroying accident.

Two free essentials close the loop. Google Search Console is the source of truth for what Google actually did: the Pages (Index Coverage) report explains why each URL is or isn't indexed, URL Inspection shows the live vs indexed state of a single page, and the Sitemaps report confirms parsing. And always validate robots.txt changes before shipping, because a single misplaced `Disallow: /` has blocked entire sites. Use Search Console's robots.txt report or a syntax tester so a typo never takes you offline.

Common mistakes and how to avoid them

The classics, in rough order of how often they wreck sites:

  • noindex + robots.txt Disallow on the same URL. The noindex is never seen, so the page won't deindex.
  • A staging-site noindex shipped to production. The dev environment's site-wide `noindex` follows the code into the live site and silently deindexes everything. Always check this after a launch.
  • Sitemap full of non-indexable URLs. Redirects, 404s and noindexed pages create mixed signals and erode trust in your sitemap.
  • Canonical pointing to a noindexed, redirected or 404 page. Google ignores a canonical that points somewhere broken.

More subtle but just as damaging:

  • Blocking CSS/JS in robots.txt. Google renders a broken page and may misjudge quality and mobile-friendliness.
  • Relative canonical URLs or canonicals with the wrong protocol/host. Always use the full absolute HTTPS URL.
  • Trusting robots.txt to hide sensitive pages. It does the opposite, publishing the path to anyone who reads the file. Use authentication and noindex instead.
  • `changefreq`/`priority` obsession. Time spent tuning these is wasted, so spend it on accurate `lastmod` and a clean URL set.

Build a habit of verification. After any change to these four files, re-crawl with Screaming Frog or Sitebulb and re-check Search Console's Pages report a few days later. A surprising share of traffic losses are self-inflicted by a well-meaning edit to robots.txt or a template that quietly added a noindex. Catching it in 48 hours instead of three months is the entire game.

Advanced tips: crawl budget, parameters and large sites

On small sites crawl budget is a non-issue, because Google fetches everything easily. On large sites (tens of thousands of URLs and up), it becomes a real constraint: if Googlebot spends its crawl allowance on faceted-navigation permutations and parameter junk, your important pages get crawled less often and update slowly in the index. The fix is architectural: block low-value parameter and filter paths in robots.txt, keep internal links pointing at clean canonical URLs, and make sure your sitemap advertises only the pages you actually want crawled.

Faceted navigation deserves a deliberate policy. A common pattern: allow crawling and indexing of a small set of valuable filter combinations (e.g. `/shoes/running`), canonicalise minor variants to their parent, and robots.txt-disallow the truly combinatorial parameter URLs (`?color=...&size=...&sort=...`) that would otherwise generate millions of near-duplicates. For faster discovery beyond Google, adopt IndexNow, supported by Bing, Yandex and others (Google does not support it as of 2026), to ping search engines the instant content changes, often via a single CMS plugin.

For very large or multi-section sites, lean on sitemap index files segmented by type and watch each segment's indexing ratio (indexed ÷ submitted) in Search Console quarter over quarter. A dropping ratio in one segment is an early warning of thin content, a template bug, or a crawl-budget squeeze, far more actionable than a single sitewide number. Treat indexability as a metric you monitor, not a setting you configure once.

2026 and AI search: robots.txt is now your GEO control panel

The crawl-and-index model now has a second audience. AI engines like ChatGPT, Perplexity, Google AI Overviews, Gemini and Claude read the web through their own user-agents, and robots.txt is where you grant or deny them access. In 2026 these companies split their bots by purpose: GPTBot (OpenAI training) is separate from OAI-SearchBot (ChatGPT's live search/citations), and ClaudeBot (Anthropic training) is separate from Claude-SearchBot. That separation is the basis of a deliberate policy. You can opt out of model training while staying eligible to be cited in AI answers, or the reverse.

Here the old lesson bites harder than ever: a page Google can't crawl is a page AI can't cite. If you robots.txt-block the search-oriented AI bots (OAI-SearchBot, PerplexityBot, Claude-SearchBot, Google-Extended for AI Overviews eligibility), you remove yourself from the answers those engines generate, and AI-search referral traffic is growing fast, with industry trackers reporting roughly 40%+ year-over-year growth into 2026. Decide consciously: a sample policy might allow the search bots while disallowing the pure training crawlers. Whatever you choose, document it, because a careless `Disallow` can quietly erase your AI visibility.

Two clarifications for 2026. First, `llms.txt` is not an access-control mechanism. The major AI vendors have not committed to honouring it, so it does not gate retrieval the way robots.txt does. Treat it, at most, as an optional content map, not a permission file. Second, the fundamentals you just learned matter *more* in AI search, not less: clean canonicals, accurate sitemaps and crawlable, well-structured pages are exactly what make your content extractable and quotable. Getting cited by an LLM still starts with being crawlable, indexable and unambiguous, the same four tools pointed at a wider audience.

Perguntas frequentes

If I add noindex, do I also need to disallow the page in robots.txt?

No, in fact you must not. Blocking the page in robots.txt prevents Google from crawling it, which means it never reads the noindex tag, and the page can stay in the index as a description-less listing. Keep the page crawlable until Google has dropped it from the index. Only then consider adding a robots.txt rule if you also want to stop wasting crawl on it.

Will adding a URL to my sitemap force Google to index it?

No. A sitemap is a discovery hint, not a guarantee. Google still decides whether a page is worth indexing based on quality, uniqueness and internal linking. The sitemap helps Google find the page faster, but you still need solid content and clear signals. For a single high-priority page, URL Inspection → Request indexing usually accelerates things more than waiting for a sitemap re-crawl.

Why does Google ignore my canonical tag sometimes?

Because canonical is a hint that Google weighs against other signals. If your internal links point to a different URL, your sitemap lists another version, there are redirects pointing elsewhere, or the canonical points to a noindexed or broken page, Google may select a different canonical. You'll see this in Search Console as 'Google-selected canonical' differing from your declared one. Align every signal (links, sitemap, redirects) with the canonical you want.

Can I use noindex and canonical on the same page?

Best practice is no. Google's John Mueller clarified in 2024 that they are contradictory signals (canonical says 'index this other URL instead', while noindex says 'don't index at all') and you should pick exactly one. Use canonical when both URLs should stay accessible and you want signals consolidated. Use noindex when the page genuinely shouldn't appear in search. Mixing them forces Google to guess, and in 2026 it increasingly just follows the most restrictive signal.

Does blocking AI crawlers in robots.txt affect my Google rankings?

Blocking AI-specific bots (GPTBot, ClaudeBot, PerplexityBot, etc.) does not affect classic Google rankings, because Googlebot is a separate crawler. But it does affect AI-search visibility: disallow OAI-SearchBot, PerplexityBot or Claude-SearchBot and you remove yourself from those engines' cited answers, and disallow Google-Extended and you opt out of AI Overviews eligibility. Because the vendors now split training and search bots, you can block training while still allowing the search/citation crawlers, so choose deliberately.

How long does it take for a noindexed page to disappear from Google?

It depends on how often Google crawls that URL, anywhere from a couple of days to a few weeks, because Google has to recrawl the page to process the noindex. You can check progress in URL Inspection, which will eventually report 'Excluded by noindex tag'. To speed up removal, use the Removals tool in Search Console for an immediate temporary hide and request a fresh crawl via URL Inspection. Don't block the page in robots.txt in the meantime, or the noindex will never be seen.

Recommended tools