Disallow in robots.txt stops a compliant crawler fetching a URL; noindex, sent in a meta robots tag or an X-Robots-Tag header, tells it not to keep the page in its index. Because a disallowed page is never fetched, a noindex on it is never read. To remove a page from an index, allow the crawl and serve noindex. To keep crawlers out of a surface that should never be indexed, use both, on that surface's own host.

The two mechanisms answer different questions: may you fetch this, and may you keep it. Most mistakes come from using one to do the other's job.

Disallow and noindex: the trap, precisely

You want a section out of the index, so you add Disallow: /internal/ to robots.txt and a noindex tag to the pages. A compliant crawler stops fetching those pages, and therefore never sees the noindex. Pages that were already indexed can stay there, because the instruction to drop them sits on a page the crawler has been told not to open.

To remove a page from the index, allow the crawl and serve noindex. To keep a crawler out of a section it was never going to index, use Disallow. Doing both to a page that is already indexed achieves the opposite of what you wanted.

The fix is to lift the Disallow until the pages have been recrawled and dropped, then decide whether you still need it.

Disallow + noindexrobots.txt: DisallowPage never fetchednoindex never readCan stay indexedAllow + noindexrobots.txt: allowedPage fetchednoindex readDropped from the index
Figure 1. The same goal, two orders of operation. Only the second removes a page that is already indexed, because the crawler has to fetch the page to read its noindex. Source: the robots exclusion and indexing directives as described in this guide.

The order matters more than the choice of directives. Allow the crawl, serve noindex, wait for the pages to be recrawled, confirm they have gone, and only then add a Disallow if you want to save crawl effort on that path. Reverse the first and last steps and the pages can stay indexed indefinitely, with every file on your side saying the right thing.

meta robots or X-Robots-Tag: which mechanism for which case

GoalMechanism
Remove an HTML page from the index<meta name="robots" content="noindex">, with crawling allowed
Remove a PDF, image or API responseAn X-Robots-Tag: noindex response header; there is no head to put a meta tag in
Keep crawlers out of an admin pathDisallow, accepting that it will not de-index anything already there
Keep a whole subdomain outThat subdomain's own robots.txt with Disallow: /, plus noindex at the application level
Point duplicates at one versionNeither: use a redirect and a canonical tag, as in canonical URLs and duplicates

The two indexing forms carry the same directives and differ only in where they live. Both accept more than one directive separated by commas, such as noindex, nofollow, and both are read only when the crawler actually receives the response. robots.txt works at a different level altogether:

robots.txt Disallowmeta robotsX-Robots-Tag
Question it answersMay you fetch this?May you keep this?May you keep this?
Where it livesOne file per hostThe HTML head of each pageThe HTTP response headers
Read whenBefore the requestAfter the page is fetchedAfter the response arrives
Works on PDFs and imagesYes, by pathNo: there is no headYes
Removes an indexed pageNoYes, if the crawl is allowedYes, if the crawl is allowed
Crawler requestHost robots.txtMay I fetch this URL?Disallow / Allow, per hostResponse headersMay I keep it?X-Robots-Tag: any file typeHTML headMay I keep it?meta robots: HTML onlyBodyThe content itselfread only if fetchedA Disallow stops the request at the first box, so nothing below it is ever read.
Figure 2. Where each directive sits in a single request. robots.txt is read before the fetch; X-Robots-Tag and meta robots are read from the response, so they only work on URLs the crawler is allowed to fetch. Source: the mechanisms described in this guide.

What each looks like in practice:

<!-- in the head of an HTML page -->
<meta name="robots" content="noindex">
# nginx: a response header for files that have no head
location ~* \.pdf$ {
add_header X-Robots-Tag "noindex" always;
}
# robots.txt served on app.example.com (not on the main site)
User-agent: *
Disallow: /

What this means for AI crawlers

robots.txt rules are written per user agent, and AI vendors split their agents by job, so a single group rarely does what people intend. OpenAI documents GPTBot for training, OAI-SearchBot for the index behind ChatGPT search, and ChatGPT-User for fetches a person asked for (OpenAI bot documentation). Google-Extended is not a crawler at all but a usage control over content Googlebot already fetched; Google's crawler documentation states that blocking it does not affect inclusion or ranking in Google Search. Applebot-Extended works the same way for Apple's model training.

Three cautions follow:

  • robots.txt is not access control for user-triggered agents. The vendors note that ChatGPT-User, Claude-User, Perplexity-User and meta-externalfetcher may not follow robots.txt when a person asks for a page. Anything that must never be fetched belongs behind authentication.
  • Do not count on noindex to keep content out of AI answers. The vendor pages cited here document robots.txt behaviour; the parts we rely on do not describe how each AI agent treats a noindex directive.
  • Test with the real user agent. A permissive robots.txt in front of a CDN or firewall rule that returns 403 to these agents is a block in practice, and the file will keep saying otherwise.

If the aim is to keep content out of model training while staying in AI answers, that is a robots.txt decision made per agent group, not an indexing one: disallow the training agents and leave the search and user agents allowed. noindex is the wrong tool for it, because it targets an index rather than a use, and it would take you out of the answers you meant to stay in.

A working file with the training and search agents separated is in robots.txt for AI crawlers, and the full agent list is in the AI crawler access guide.

Platform switches that set these for you

  • WordPress: Settings, Reading, "Discourage search engines from indexing this site" emits a noindex and also disables core XML sitemaps, so /wp-sitemap.xml starts returning 404. A staging site promoted with that box ticked loses its sitemap silently (WordPress core announcement).
  • HubSpot: robots.txt is a per-domain admin setting, and system domains containing hs-sites are permanently no-index whatever you write. A blanket disallow also catches HubSpotContentSearchBot and breaks on-site search unless it gets its own allow group (HubSpot knowledge base).
  • Webflow: disabling subdomain indexing publishes a different, blocking robots.txt on the webflow.io staging subdomain, so auditing there tells you nothing about your custom domain (Webflow help).
  • Shopify: the default robots.txt already disallows /admin, /cart, /checkout, /search, /policies/ and filtered collection URLs. Changes go in a robots.txt.liquid template that adds to the defaults, and only the published theme's template is served (Shopify developer docs).

The subdomain nobody checks

Every robots.txt applies only to the host that serves it. Your marketing site's file says nothing about your app, your docs, your staging environment or a CDN host. Each one needs its own. A common gap is an application subdomain with no robots.txt at all: the request returns the application's own 404 page, which is not a robots file, so the subdomain is open to crawling. A logged-in product back end has no reason to appear in search results or AI answers.

Each host reads only its own /robots.txtexample.comrobots.txt presentapp.example.comapp 404, not a robots file:open to crawlingdocs.example.comneeds its own filestaging.example.comDisallow: / plus noindexcdn.example.comneeds its own file
Figure 3. robots.txt is per host. An application subdomain that answers /robots.txt with its own 404 page has no rules at all. Source: the robots exclusion standard; host names are placeholders.

List your hosts before you audit them. Certificates, DNS records and your CDN configuration are better inventories than memory, because staging and preview hosts tend to be created quickly and forgotten. Then fetch /robots.txt on each one and record which of three things came back: a robots file, an error page, or nothing at all.

When you audit, keep "could not fetch" separate from "not present". A timeout on robots.txt tells you nothing about whether the file exists, and treating the two as the same is how an audit sends you to fix something that is already fine.

Belt and braces, deliberately

For a surface that should never be indexed, such as an app or a staging host, use both: a robots.txt with Disallow: / to stop compliant crawlers, and application-level noindex to cover pages that get linked from elsewhere and fetched anyway. This is the one case where doing both is correct rather than contradictory, because you do not need anything removed; you need it never to be indexed in the first place. If the surface was indexed before you added the rules, lift the Disallow first, let the noindex be read, then put it back.

Verify by response, not by configuration

A framework's metadata API, a CDN rule and the origin configuration can each override the others. The only thing that settles it is the response a crawler receives:

curl -sI https://example.com/files/brochure.pdf | grep -i "x-robots-tag"
curl -s https://example.com/internal/page/ | grep -io '<meta[^>]*name="robots"[^>]*>'
curl -s https://app.example.com/robots.txt | head

Read the output against what you intended. The first command should print one X-Robots-Tag line; if it prints nothing, check whether the header is only being added to some responses, which is why the nginx example uses always. The second should print exactly one robots meta tag: two on the same page mean two components are writing it, and you should find out which one the crawler obeys rather than guess. The third should return a plain robots file, not an HTML error page.

Run these on every host you own, not just the main domain. The technical access reference collects the other checks worth running at the same time.

Sources