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 servenoindex. To keep a crawler out of a section it was never going to index, useDisallow. 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.
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
| Goal | Mechanism |
|---|---|
| Remove an HTML page from the index | <meta name="robots" content="noindex">, with crawling allowed |
| Remove a PDF, image or API response | An X-Robots-Tag: noindex response header; there is no head to put a meta tag in |
| Keep crawlers out of an admin path | Disallow, accepting that it will not de-index anything already there |
| Keep a whole subdomain out | That subdomain's own robots.txt with Disallow: /, plus noindex at the application level |
| Point duplicates at one version | Neither: 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 Disallow | meta robots | X-Robots-Tag | |
|---|---|---|---|
| Question it answers | May you fetch this? | May you keep this? | May you keep this? |
| Where it lives | One file per host | The HTML head of each page | The HTTP response headers |
| Read when | Before the request | After the page is fetched | After the response arrives |
| Works on PDFs and images | Yes, by path | No: there is no head | Yes |
| Removes an indexed page | No | Yes, if the crawl is allowed | Yes, if the crawl is allowed |
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
noindexto 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 anoindexdirective. - 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
noindexand also disables core XML sitemaps, so/wp-sitemap.xmlstarts 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.
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
- OpenAI, Overview of OpenAI crawlers.
- Google, Google's common crawlers (Google-Extended).
- User-triggered agents that may not follow robots.txt: Anthropic, Perplexity and Meta crawler documentation.
- WordPress, New XML sitemaps functionality in WordPress 5.5.
- HubSpot, Customize the robots.txt file.
- Webflow, Disable search engine indexing (reported from the help centre).
- Shopify, robots.txt.liquid template.