X-Robots-Tag

The X-Robots-Tag HTTP header carries the same directives as the robots meta tag, so you can noindex PDFs, images, and videos. Apache, Nginx, and Cloudflare configs plus how to verify with curl.

First published: Jun 23, 2026 · Last updated: Jul 18, 2026 · Advanced
demand #9 in Meta Tags#27 in On-Page#125 in Technical SEO#168 on the site
1 evidence signal on this page

The X-Robots-Tag is the HTTP-header twin of the robots meta tag: same directive vocabulary (noindex, nofollow, nosnippet, and the rest), but delivered in the response header so it works on files with no HTML <head> — PDFs, images, videos, anything. You set it at the server (Apache, Nginx, or a CDN/Worker), so one rule can noindex every PDF on the site. The single most common mistake is also blocking that file in robots.txt — which hides the header, so Google never crawls the file to read the noindex and the directive is ignored. Verify the live header with curl -I, and watch for a CDN serving a different header than your origin (the 'Noindex detected in X-Robots-Tag' Search Console failure).

TL;DR — The X-Robots-TagThe X-Robots-Tag is an HTTP response header that carries the same indexing and serving directives as the robots meta tag (noindex, nofollow, nosnippet, and the rest). Because it lives in the header rather than the HTML, it's how you control indexing for non-HTML files like PDFs, images, and videos. is the HTTP-header delivery of the same directive vocabulary as the robots meta tagThe robots meta tag is an HTML element in a page's head — <meta name=\"robots\" content=\"noindex\"> — that tells search engines how to index and serve that page. It's crawl-then-obey: a page blocked in robots.txt is never fetched, so the tag is never seen.“Any rule that can be used in a robots meta tag can also be specified as an X-Robots-Tag.” It exists for one big reason: non-HTML resources (PDFs, images, videos) have no <head>, so the header is the supported way to noindexNoindex is a directive that tells search engines to keep a page out of their index, so it won't appear in search results. It works only on pages a crawler can actually fetch — a page blocked in robots.txt can never be noindexed. them. You set it server-side (Apache <FilesMatch>, Nginx add_header, or a Cloudflare Transform Rule / Worker), so one rule covers a whole file type. Optionally target a crawlerA crawler — also called a spider or bot — is an automated program that fetches web pages, extracts their links, and queues new URLs to visit. Search engines use crawlers to discover and download content for their index. with X-Robots-Tag: googlebot: noindex; with no user-agentA user agent is the HTTP request header a client (browser, crawler, or bot) sends to identify itself. For crawlers, a short user-agent token — a substring of that string — is what robots.txt rules actually target. it applies to all of them. The spine caveat, shared with the meta tag: the file must be crawlable — a robots.txtA plain-text file at the root of a host that tells crawlers which URLs they may and may not request. It controls crawling, not indexing — a blocked URL can still be indexed if it's linked from elsewhere. block hides the header, so the noindexNoindex is a directive that tells search engines to keep a page out of their index, so it won't appear in search results. It works only on pages a crawler can actually fetch — a page blocked in robots.txt can never be noindexed. is “not foundA 302 (\"Found\") is a temporary redirect: it forwards users to a new URL while telling search engines the original URL should stay in the index. It's a weak canonicalization signal, not the zero-equity dead end of SEO folklore. and… therefore ignored.” Verify with curl -I, and watch for CDN-vs-origin header drift.

Evidence for this claim Google supports robots directives in the X-Robots-Tag HTTP response header, including for non-HTML resources such as PDFs. Scope: Google crawling and indexing controls delivered by HTTP header. Confidence: high · Verified: Google Search Central: X-Robots-Tag Evidence for this claim Google must be allowed to crawl a resource to discover and apply its X-Robots-Tag noindex rule. Scope: A robots.txt block can prevent Google from seeing the response header. Confidence: high · Verified: Google Search Central: Combining crawling and indexing rules

What the X-Robots-Tag actually is

The X-Robots-Tag is the HTTP response header version of the robots <meta> tag. That’s the whole concept. Google is explicit that the two are interchangeable in vocabulary: “The X-Robots-Tag can be used as an element of the HTTP header response for a given URL. Any rule that can be used in a robots meta tag can also be specified as an X-Robots-Tag.” A response carrying it looks like this:

HTTP/1.1 200 OK
Date: Tue, 25 May 2010 21:42:43 GMT
(…)
X-Robots-Tag: noindex
(…)

So if you already understand the robots meta tagThe robots meta tag is an HTML element in a page's head — <meta name=\"robots\" content=\"noindex\"> — that tells search engines how to index and serve that page. It's crawl-then-obey: a page blocked in robots.txt is never fetched, so the tag is never seen., you already understand the directives here — noindex, nofollow, nosnippet, and the rest behave identically for Google. The only thing that changes is the delivery mechanism: header, not HTML.

That equivalence is a Google-documented contract, not a universal web standard — the X-Robots-Tag is a de facto header with no IETF specification backing it. Google says so directly on the same doc: “It is possible that these rules may not be treated the same by all other search engines.” Treat “same directives as the meta tag” as true for Google (and, per the Other Engines section below, largely true for Bing’s core set) — not as a guarantee for every crawlerA crawler — also called a spider or bot — is an automated program that fetches web pages, extracts their links, and queues new URLs to visit. Search engines use crawlers to discover and download content for their index., including AI crawlersAI crawlers are bots from AI companies that fetch web pages to train language models, build AI-search indexes, or answer live user questions. They come in three categories, each with its own user-agent tokens and its own robots.txt controls., that might read this header.

Why it exists — non-HTML files

The defining use case is files that have no HTML <head> to drop a meta tag into. Google’s guidance is direct: “To block indexingStoring a crawled page in the search index so it can appear in results. Crawled is not the same as indexed — Google selects what to keep, and indexing isn't guaranteed. of non-HTML resources, such as PDF files, video files, or image files, use the X-Robots-Tag response header instead.” That’s the headline. A PDF, an image, or a video can’t carry a robots meta tag — there’s nowhere to put it — so the header is the supported route to noindex them.

There’s a second, quieter reason: it’s set server-side, so one rule can apply a directive to an entire class of files (every .pdf on the site) or site-wide, without you editing each resource. That’s powerful, and — as we’ll see — also where the foot-guns live.

Worked example — noindexing a single PDF: say https://example.com/whitepapers/old-report.pdf is showing up in search and you want it gone. Two conditions both have to hold: (1) the resource must stay crawlable — no Disallow on it in robots.txt — and (2) the server response for that exact URL must carry X-Robots-Tag: noindex. Set the rule (Apache/Nginx/ Cloudflare examples below), confirm with curl -I that the live response actually returns the header (see the verification section), then wait for Google to recrawl the URL. Skip either condition and the PDF stays indexed: skip crawlabilityCrawlability is how well search engine crawlers can discover, access, and fetch a site's pages. A crawlability issue is any technical condition — blocked access, broken links, server failures, or bloated URL inventory — that stops pages from reaching the index. and Google never reads the header; skip the header and there’s nothing telling Google to drop it.

Do not turn “non-HTML” into “wrong file type.” Google publishes a broad list of indexable file types, including PDF, common office formats, text, XML, and several source-code formats. A crawler should preserve three separate observations: the URL extension, the declared Content-Type, and the bytes actually returned. A mismatch is a delivery warning; a legitimate supported document is not an HTML-page failure and should have HTML-only checks marked not applicable. Use X-Robots-Tag or an HTTP Link canonical when those controls are needed for the non-HTML resource.

Size limits also need an engine-and-basis label. Google’s March 2026 crawler update documents a 2 MB per-URL cutoff for GooglebotGooglebot is Google's web crawler — the software that fetches pages so Google can index and rank them. It comes in two variants, Googlebot Smartphone (primary, under mobile-first indexing) and Googlebot Desktop, and runs an evergreen Chromium renderer. (Search), a 64 MB PDF cutoff, and a 15 MB default for unspecified Google crawler clients. Those are decimal MB resource limits, not interchangeable with a tool’s decoded-body MiB safety cap. See Google’s current crawler limits before turning a product limit into an SEO diagnosis.

Meta tag vs X-Robots-Tag — when to use which

The decision is simple once you frame it around the <head>:

  • HTML page you control the markup of → use the robots meta tag. It’s easier to set, easier to read, and per-page.
  • Non-HTML file (PDF, image, video, feed) → use the X-Robots-Tag header. There’s no other option; these have no <head>.
  • You’d rather control it server-side / site-wide, or you can’t easily touch each page’s HTML (CDN, app layer) → the header is the cleaner lever even for HTML.

They’re not rivals and one isn’t “stronger” — same directives, different reach.

The directives you can use

The X-Robots-Tag accepts the same directive vocabulary as the meta tag. The full supported set:

  • noindex — don’t index this resource.
  • nofollow — don’t follow links from it.
  • none — shorthand for noindex, nofollow.
  • all — no restrictions (the default).
  • nosnippet — no text snippet or video preview in results (the page-level cousin of data-nosnippet, which scopes it to part of a page).
  • max-snippet: [number] — cap the snippet length.
  • max-image-preview: [none | standard | large] — cap the preview image size.
  • max-video-preview: [number] — cap the video preview length in seconds.
  • noarchive — no cached link.
  • noimageindex — don’t index images on the page.
  • notranslate — don’t offer translation in results.
  • indexifembeddeddon’t index this resource on its own, but do allow indexingStoring a crawled page in the search index so it can appear in results. Crawled is not the same as indexed — Google selects what to keep, and indexing isn't guaranteed. where it’s embedded (e.g. in an iframeHTML element that displays one webpage inside another — how embeds work.). Pair it with noindex.
  • unavailable_after: [date/time] — drop the URL from results after a date. The date must be in a widely adopted format (RFC 822, RFC 850, or ISO 8601), e.g.:
X-Robots-Tag: unavailable_after: 25 Jun 2010 15:00:00 PST

Presenting the table once is deliberate: it’s the same list shared by the meta tag, which is the cleanest way to think about the relationship between the two.

Targeting a specific crawler

You can optionally prefix the directive with a user-agent token: Google notes the header “may optionally specify a user agentA user agent is the HTTP request header a client (browser, crawler, or bot) sends to identify itself. For crawlers, a short user-agent token — a substring of that string — is what robots.txt rules actually target. before the rules,” and that “Rules specified without a user agent are valid for all crawlers. The HTTP header, the user agent name, and the specified values are not case sensitive.” So this is valid syntax to noindex only for Google:

X-Robots-Tag: googlebot: noindex

And you can stack lines for different bots. (One note on attribution: Google’s own documented example of per-crawler targeting uses X-Robots-Tag: googlebot: nofollow paired with X-Robots-Tag: otherbot: noindex, nofollow — so googlebot: noindex is correct, supported syntax, just not the verbatim line in Google’s sample.)

Multiple rules and conflicting directives

You’re not limited to one directive per response. Google documents this directly: “Multiple rules may be combined in a comma-separated list or in separate meta tagsMeta tags are HTML elements in a page's head that pass metadata about the page to search engines and browsers. For SEO only a few matter — the title element, the meta description, and the robots meta tag — while meta keywords and most others are ignored.. These rules are case-insensitive.” — the same is true for the header: send X-Robots-Tag: noindex, nofollow as one comma-separated line, or repeat the header field (X-Robots-Tag: noindex on one line, X-Robots-Tag: nofollow on another). Both are valid; the server config examples below use the comma-separated form.

When two rules would conflict, Google resolves it in favor of the tighter restriction: “In the case of conflicting robots rules, the more restrictive rule applies. For example, if a page has both max-snippet:50 and nosnippet rules, the nosnippet rule will apply.” That’s Google’s documented behavior — the same “not treated the same by all other search engines” caveat above applies to conflict resolution too, so don’t assume every crawler picks the stricter rule the same way.

Evidence for this claim Google accepts multiple X-Robots-Tag rules as a comma-separated list or repeated header fields, and resolves conflicting rules by applying the more restrictive one; this behavior is documented for Google specifically, not guaranteed across all crawlers. Scope: Google's handling of multiple/conflicting robots meta and X-Robots-Tag directives. Confidence: high · Verified: Google Search Central: repeated and comma-separated X-Robots-Tag rules Supports: Multiple X-Robots-Tag rules may use repeated headers or a comma-separated list. Google Search Central: conflicting robots rules Supports: Google applies the more restrictive rule when robots rules conflict. Google Search Central: cross-engine treatment may differ Supports: Other search engines may treat these rules differently.

How to set it (server config)

These are known-good, battle-tested patterns I’d reach for — treat every snippet below as an environment-specific example, not a portable recipe: inheritance rules, route matching, redirectsA redirect sends browsers and crawlers from a requested URL to a different one. An HTTP redirect specifically is a 3xx status code paired with a Location header; meta refresh and JavaScript redirects achieve a similar navigation without being a 3xx response themselves. Permanent redirects (301/308) are Google's signal the target should be canonical; temporary ones (302/303/307) aren't., response status codes, and any CDN or application layer in front of the server can all change what actually reaches the crawler. Confirm the delivered header on your own stack before shipping, not just the config file. Configs and snippets are in the Scripts tab, copy-paste ready, for Apache (<FilesMatch> + mod_headers), Nginx (location

  • add_header), and Cloudflare (a Transform Rule or a Worker). The short version: one rule, matched on the file extension, sets X-Robots-Tag: noindex on every file of that type. To target a single crawler, the user-agent token goes inside the header value (Header set X-Robots-Tag "googlebot: noindex"), not as a separate mechanism.

The #1 mistake — don’t block the file in robots.txt

This is the spine of the whole topic, so I’ll be loud about it. People who want a PDF gone often do two things at once: block it in robots.txt and set X-Robots-Tag: noindex. That defeats itself. Google has to crawl the file to read the header — and the robots.txtA plain-text file at the root of a host that tells crawlers which URLs they may and may not request. It controls crawling, not indexing — a blocked URL can still be indexed if it's linked from elsewhere. block stops the crawl.

Google’s own wording: “robots meta tags and X-Robots-Tag HTTP headers are discovered when a URL is crawled. If a page is disallowed from crawlingCrawling is how search engines use automated bots (like Googlebot and Bingbot) to discover URLs and download pages. A page has to be crawlable to be indexed, but crawling on its own isn't a ranking factor. through the robots.txt file, then any information about indexing or serving rules will not be found and will therefore be ignored.” And the corollary: “If indexing or serving rules must be followed, the URLs containing those rules cannot be disallowed from crawling.”

Restated for noindex specifically: “For the noindex rule to be effective, the page or resource must not be blocked by a robots.txt file, and it has to be otherwise accessible to the crawler. If the page is blocked by a robots.txt file or the crawler can’t access the page, the crawler will never see the noindex rule, and the page can still appear in search results.” This is the same crawling-vs-indexing distinction that runs through robots.txt and the meta tag: robots.txt controls crawling; the X-Robots-Tag controls indexing; and a crawl block hides the indexing rule. To deindex a PDF: allow crawling, serve X-Robots-Tag: noindex, and wait for the re-crawl.

(Note the flip side too: a robots.txt Disallow on its own doesn’t deindex a file either — a blocked PDF can still be indexed if other pages link to it, just without a snippet. Blocking and noindexing solve different problems.)

How to verify it with curl

Don’t trust that a config “should” work — check the live header. curl -I (or curl -sI … | grep -i x-robots-tag) prints the response headers without downloading the body:

curl -sI https://example.com/file.pdf | grep -i x-robots-tag

You can also spoof the bot view to see what Googlebot would get (curl -A "Googlebot" -sI …). Most guides point you at a browser extension or Screaming Frog for this; curl is faster and scriptable, and full commands are in the Scripts tab.

One caveat on -I: it sends a HEAD request, and a server or CDN rule that only fires on GET won’t show up in a HEAD response. Treat curl -I as a fast first check, not the final word — confirm the same header on a real curl GET request (curl -sD - -o /dev/null https://example.com/file.pdf | grep -i x-robots-tag), and check it after following redirects and on the public CDN-fronted URL, not just origin.

TIP Inspect the header Googlebot receives, not the rule you intended

X-Robots-Tag is an HTTP-level signal, so verification has to happen on the public response. A CDN can add, strip, cache, or vary it after the origin configuration looks correct.

Use my HTTP Header Checker to follow the redirect chain, switch user agents, and inspect the exact final X-Robots-Tag value without working through raw curl output. HTTP Header Checker Free

  1. Check the public file URL with the search-crawler user agent and inspect every redirect hop.
  2. Confirm the final response carries the intended directive and does not vary unexpectedly at the CDN.
  3. Keep the resource crawlable so the crawler can actually discover the noindex header.

Watch for CDN-vs-origin drift

Because the header is set server- and CDN-side, the value Googlebot receives can differ from what your origin emits — an edge rule can add, strip, or cache a header. The real-world failure mode here is the “Noindex detected in X-Robots-Tag” message in Search ConsoleGoogle's free tool for monitoring crawling, indexing, and search performance.: a CDN or edge config serving an X-Robots-Tag: noindex — even briefly or by mistake — gets logged by Google as a noindex signal and can deindex pages you never meant to touch. The lesson: always curl -I the public URL behind the CDN, not just origin, and treat edge rules with the same care as origin config.

Other engines

Bing supports the X-Robots-Tag header and broadly the same core directives — noindex, nofollow, noarchive/nocache (Bing uses nocache as a synonym for noarchive), nosnippet, and the preview-limit directives. If you need Bing’s exact supported list, confirm it on Bing’s live help page — their documentation is JavaScript-rendered and worth eyeballing directly before relying on a specific directive.

Where this sits

The X-Robots-Tag is the non-HTML half of on-page indexing control: the robots meta tag for pages, this header for everything else. It leans on the same noindex, nosnippet / max-snippet / max-image-preview vocabulary, and it depends on crawling being allowed — which ties it straight back to robots.txt and the broader indexing story. If you came here from the crawling side, the takeaway is the caveat; if you came from the meta-tag side, the takeaway is that the same directives reach PDFs and media through the header.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.