X-Robots-Tag: How to Use the Noindex Header

X-Robots-Tag is the HTTP header that noindexes PDFs, images and whole folders. Copy-ready Apache, Nginx, Cloudflare and Vercel setups, plus how to check it.

X-Robots-Tag: How to Use the Noindex Header

X-Robots-Tag is an HTTP response header that tells search engines how to index the URL it comes with. X-Robots-Tag: noindex keeps that URL out of search results, just like a <meta name="robots" content="noindex"> tag, but it travels in the server's response instead of the HTML. That makes it the way to noindex PDFs, images and other files that have no HTML head, and to cover a whole folder or file type with one server rule. Google supports every robots meta tag rule in the header, and Bing reads it too. One condition: Google must be allowed to crawl the URL, or it never sees the header.

Below: the rules, copy-ready setups for Apache, Nginx, Cloudflare, Vercel and Netlify, how to check any URL, and how often 1,545 connected sites had a noindex in the header rather than the tag.

What is the X-Robots-Tag header?

The X-Robots-Tag header is one line in the HTTP response your server sends before the content. For a PDF that should stay out of search:

HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindex

Google's robots meta tag and X-Robots-Tag documentation says any rule that can be used in a robots meta tag can also be sent as an X-Robots-Tag. The difference is where the rule lives. A meta tag is part of one HTML page. The header is set in your web server, CDN or app configuration.

Visitors never see the header, and "view source" does not show it either. That is why a noindex header is easy to forget, and the first thing to check when Google says a page is noindexed but its HTML has no tag.

X-Robots-Tag vs meta robots tag: when to use the header

Use the meta tag for ordinary HTML pages you can edit, and the header when the URL has no HTML head or when one rule should cover many URLs. For Google the two are equal: the same rules, with the same effect.

Robots meta tagX-Robots-Tag header
Where it livesIn the HTML head of one pageIn the HTTP response, set by the server, CDN or app
Works onHTML pages onlyAny URL: HTML pages, PDFs, images, video and other files
CoversOne page per tag, or every page of a templateOne file, a folder, a file type or a whole host, by rule
Who can change itAnyone who edits the page or its CMS settingsWhoever controls the server, CDN or hosting config
Visible in page sourceYesNo, only in the response headers
Rules Google supportsAll robots rulesAll robots rules
Google must crawl the URL to see itYesYes

Pick the header in these cases:

  • PDFs, images and other files. A file without HTML cannot carry a meta tag. Google's guide to blocking indexing with noindex says the header "can be used for non-HTML resources, such as PDFs, video files, and image files." If a file only duplicates another version, a Link: <https://www.example.com/white-paper.pdf>; rel="canonical" header names the one to index instead (Google's canonical guide).
  • A whole folder or file type. One server rule noindexes every file in /downloads/ or every PDF on the site, including files you add later.
  • Pages whose HTML head you cannot edit, behind a server or CDN that you do control.
  • A staging or preview host. One header on the whole hostname keeps a copy of your site out of search without touching any template.

For the meta tag itself, including the noindex and nofollow combinations and the WordPress settings, see our noindex tag guide.

Which X-Robots-Tag directives does Google support?

Google supports twelve rules in the X-Robots-Tag header, the same list as in the robots meta tag. The list as of Google's documentation, last updated March 24, 2026:

DirectiveWhat it does in Google Search
allNo restrictions. It is the default, so listing it changes nothing.
noindexKeeps the page, media or file out of search results.
nofollowGoogle does not follow the links on the page.
noneMeans noindex and nofollow together.
nosnippetNo text snippet or video preview. It also keeps the content from being used as direct input for AI Overviews and AI Mode.
indexifembeddedLets Google index the content when another page embeds it in an iframe, despite noindex. It only works together with noindex.
max-snippet:[number]Limits the text snippet to that many characters. 0 means no snippet, -1 lets Google choose.
max-image-preview:[setting]Sets the largest image preview: none, standard or large.
max-video-preview:[number]Limits video previews to that many seconds. 0 allows a still image at most, -1 means no limit.
notranslateGoogle does not offer a translation of the page in search results.
noimageindexThe images on the page are not indexed.
unavailable_after:[date/time]Stops showing the URL after that date and time, written in a common format such as ISO 8601 or RFC 822.

Three rules still found in old configs do nothing in Google Search: noarchive (Google's cached link no longer exists), nocache and nositelinkssearchbox. Bing reads robots rules from the X-Robots-Tag header as well as from the meta tag, as its webmaster blog confirmed when it added snippet controls in April 2020.

How to combine several directives

Put several rules in one header, separated by commas, or send several X-Robots-Tag headers. Google reads both. The header name, the crawler name and the values are not case sensitive. When rules conflict, the more restrictive one wins: with max-snippet:50 and nosnippet on the same URL, Google applies nosnippet.

X-Robots-Tag: max-snippet:120, max-image-preview:large
X-Robots-Tag: unavailable_after: 2026-12-31

How to target one crawler

Write a crawler's user agent token and a colon before the rules. A rule without a token applies to every crawler; a rule for one crawler is ignored by the others.

X-Robots-Tag: googlebot: noindex
X-Robots-Tag: otherbot: nosnippet

The first line keeps the URL out of Google only. Google's own tokens are googlebot and googlebot-news.

How to add an X-Robots-Tag noindex header

Set the header where your responses are built: the web server, the CDN in front of it, or your host's config file. Most examples below noindex document files (PDF and Word) or everything in a /downloads/ folder; change the pattern to fit your site.

Apache (.htaccess)

Apache needs the mod_headers module. Add this to the .htaccess file in your site's root ((?i) also catches .PDF and .DOCX):

<IfModule mod_headers.c>
  <FilesMatch "(?i)\.(pdf|docx?)$">
    Header set X-Robots-Tag "noindex"
  </FilesMatch>
</IfModule>

For images, match "(?i)\.(png|jpe?g|gif|webp)$" instead. For one folder, put an .htaccess file in that folder with the rule and no FilesMatch:

<IfModule mod_headers.c>
  Header set X-Robots-Tag "noindex"
</IfModule>

Keep the IfModule wrapper: on a server without mod_headers, a bare Header line makes Apache answer every file in that folder with a 500 error. Apache's mod_headers documentation allows the directive in .htaccess only where AllowOverride includes FileInfo, so if the rule has no effect, ask your host.

Nginx

Add a location block that matches the files, inside the right server block:

location ~* \.(pdf|docx?)$ {
    add_header X-Robots-Tag "noindex" always;
}

Nginx uses the first regex location that matches, so put this block above any existing one that also matches these files, such as a static file cache block. Two more details from the Nginx headers module docs catch people out. Without always, add_header only applies to status 200, 201, 204, 206, 301, 302, 303, 304, 307 and 308, so keep it there to send the header with every status. And an add_header inside a location block cancels the add_header lines inherited from the server block, so security headers set there vanish for those files unless you repeat them (from Nginx 1.29.3, add_header_inherit merge; keeps them).

PHP

When a PHP script sends the file or page, set the header before any output:

header('X-Robots-Tag: noindex');

Cloudflare

Cloudflare can add the header at the edge, without touching your server, through a response header Transform Rule. The steps in Cloudflare's docs:

  1. In the dashboard, open Rules > Overview and select Create rule > Response Header Transform Rule.
  2. Name the rule. Under When incoming requests match, pick a custom filter expression and enter ends_with(http.request.uri.path, ".pdf"), or starts_with(http.request.uri.path, "/downloads/") for a folder.
  3. Under Modify response header, choose Set static, with header name X-Robots-Tag and value noindex.
  4. Select Deploy.

Set static overrides any X-Robots-Tag your server already sends; Add static keeps it and adds a second one.

Vercel and Next.js

On Vercel, add a headers entry to vercel.json:

{
  "headers": [
    {
      "source": "/downloads/(.*)",
      "headers": [{ "key": "X-Robots-Tag", "value": "noindex" }]
    }
  ]
}

In a Next.js app that runs the Next.js server, on any host, use headers() in next.config.js (a static export with output: 'export' does not apply it, so set the header on your host instead):

module.exports = {
  async headers() {
    return [
      {
        source: '/downloads/:path*',
        headers: [{ key: 'X-Robots-Tag', value: 'noindex' }],
      },
    ]
  },
}

Per the Next.js headers docs, headers are checked before the filesystem, so the rule also covers files in /public. Vercel itself adds X-Robots-Tag: noindex to preview deployments and to production deployments opened through their unique deployment URL, but not to a preview served from a custom domain assigned to a Git branch (Vercel's guide). A noindex on a preview URL is expected; on your production domain it is not.

Netlify

Save a plain text file named _headers in the folder you deploy (the publish directory):

/downloads/*
  X-Robots-Tag: noindex

Netlify's custom headers docs note that these headers apply only to files Netlify serves itself. Pages rendered by a function or edge function, and proxied content, must send the header themselves.

Why Google may not see your X-Robots-Tag

Google reads the header only when it crawls the URL, so anything that stops or delays that crawl stops the rule:

  • A robots.txt block. If robots.txt disallows a URL, Google says its indexing rules "will not be found and will therefore be ignored." A blocked PDF can stay in Google from links, and URL Inspection shows Indexing allowed? Yes for it, because Google never saw the header. Our post on why noindex in robots.txt fails shows the way out.
  • No recrawl yet. The header works from Google's next crawl, and Google says it "may take months" to revisit a page it considers unimportant. If a file must disappear now, Search Console's Removals tool hides it for about six months while the noindex takes effect.
  • Googlebot gets a different response than you do. A rule scoped to one hostname, a stale CDN cache or a user agent rule can make your test and Google's crawl disagree. Compare a live test in Search Console with what you see yourself.

How to check the X-Robots-Tag of a URL

Look at the response headers, not the page source. Any of these four works, and the last one shows what Google itself saw:

  1. The free noindex checker. It works as an X-Robots-Tag checker for any public URL: it reads the X-Robots-Tag header, the robots and googlebot meta tags and the robots.txt rules in one pass, and shows the exact directive it finds.
  2. curl. curl -sI https://example.com/file.pdf prints the response headers; look for an x-robots-tag line. -I sends a HEAD request, which a few servers answer differently, so curl -s -o /dev/null -D- https://example.com/file.pdf makes a normal GET and prints only the headers. Add -L to see the headers of every redirect hop.
  3. Your browser. Open DevTools, go to the Network tab and reload. Select the request in the Name column and read Response Headers in the Headers tab (Chrome's DevTools reference).
  4. URL Inspection in Search Console. After inspecting the URL, open Page indexing and find the Indexing allowed? line. When Google found a noindex, it says No and gives the reason; for a header, the reason names the X-Robots-Tag http header. Click Test live URL to check today's response instead of the last crawl. After the fix, when the live test says URL is available to Google, View tested page > More info shows the HTTP headers Google received. While the noindex is still there, that panel is not available, so use curl or the checker to find the header. The rest of that screen is explained in our URL Inspection tool guide.

Only that Indexing allowed? line tells the two sources apart. URL Inspection gives a page blocked by either one the same status, Excluded by 'noindex' tag, and the Page indexing report puts both in one noindex row (Google's help page now calls it URL marked 'noindex'). So "tag" in that label does not mean the rule is in your HTML.

When the header is gone, click Request indexing. Search Console allows only a handful of requests per property each day; the Request Indexing guide has the numbers.

Header or meta tag: what we found across 1,545 sites

For a URL in Excluded by 'noindex' tag, Google's inspection result also says where it found the rule: in a robots meta tag or in the X-Robots-Tag header. We split those URLs on the 1,545 sites connected to IndexMachine with at least one sitemap URL that had a URL Inspection state, as of November 19, 2026 (1,397,832 sitemap URLs, each counted in its latest state on record, not a live check). Aggregate counts only, with no site or URL named. A property connected by two accounts counts once for each, and the sites lean toward indexing trouble, since their owners signed up for an indexing tool.

Where the noindex satSitemap URLsSites with at least oneOf those, sites whose owner had it on another connected site too
Robots meta tag13,50511977 (65%)
X-Robots-Tag header6,0047672 (95%)

What the numbers say:

  • The header is less common than the tag, but not rare. 76 sites had at least one sitemap URL noindexed by the header, against 119 by the meta tag, and fewer than 5 had both. Both counts lean on a few owners with many connected sites, and most of the header URLs sat on sites connected after the October 31 snapshot in our Search Console API guide, so the higher count here reflects new sites, not a trend.
  • In sitemaps, the header sat on web pages, not on files. Every one of the 6,004 was a web page. Sorted by the extension at the end of the path, sitemaps hardly list files: 126 of the 1,397,832 URLs were PDFs, images or other files (documents, XML, archives, media), on 34 sites, and none was excluded for noindex. So a noindex header on a sitemap URL is a server, CDN or app rule that reaches your pages, and worth checking.
  • Header rules spread across sites. 72 of the 76 sites (95%) were connected by an owner who also had header-noindexed sitemap URLs on another of their sites. For the meta tag it was 77 of 119 (65%). That fits how headers are set: in server, hosting or CDN configuration that gets reused. If one of your sites has it, check the others on the same setup.
  • Sometimes it is the homepage. On 6 sites, the header noindexed the homepage itself. On 8 sites, a meta tag did.

Find the pages a noindex header keeps out

Sign in to a free IndexMachine account with Google and it lists, for every site in your Search Console, the sitemap pages Google left out and the reason: a noindex sent in a header shows up there just like one in a tag. One click on a page Google turned down gives the likely cause and the steps to fix it. With indexing turned on, the IndexMachine Chrome extension runs Google's own Request Indexing in your Search Console, on autopilot, with your full daily Google quota on every site, and once the header is gone, Request indexing now sends the fixed page to Google right away. Pages Google already shows as indexed are skipped, every requested page is tracked until it is on Google, and every other engine gets unlimited IndexNow. Of 1,841 pages requested, 1,418 (77%) were on Google, typically in about 3 days by our first check. You can pay once for lifetime access or subscribe.

See which pages a hidden noindex header blocks

Sign in free with Google: IndexMachine imports your Search Console sites and lists the sitemap pages Google has not indexed, with the reason, so a noindex that lives only in a response header shows up too. When you are ready, turn on Google's own Request Indexing in your Search Console, on autopilot, plus unlimited IndexNow.

FAQs

Is X-Robots-Tag better than the meta robots tag?

Neither is stronger: Google treats the same rule the same way in either place. The header is the only option for PDFs, images and other files, and the easier one for whole folders. The meta tag is easier for single HTML pages, because anyone who edits the page can see it.

What happens if the X-Robots-Tag header and the meta tag disagree?

Google applies the more restrictive rule. A noindex in either place keeps the page out of Google Search, even if the other one says nothing or lists all. Remove the rule from both places if you want the page indexed.

Can X-Robots-Tag keep images out of Google Images?

Yes. Send X-Robots-Tag: noindex with the image files themselves; Google's own Apache and Nginx examples match .png, .jpg, .jpeg and .gif files. The noimageindex rule works differently: it goes on an HTML page and stops Google from indexing the images on that page.

Why does Search Console say a page is noindexed when its HTML has no noindex tag?

The noindex is probably in the X-Robots-Tag header, which page source does not show. Check the response headers with curl or the noindex checker. If the header is not there now, run Test live URL: the indexed result describes Google's last crawl, which can predate your fix. Also check CDN rules and your host's preview settings.

How do I remove an X-Robots-Tag noindex header?

Find the rule that sets it and delete it: in .htaccess or the Apache config, the Nginx config, a Cloudflare Transform Rule, vercel.json or next.config.js, a Netlify _headers file, a PHP header() call, or an SEO plugin or app setting. Clear your CDN cache, confirm with curl that the header is gone, then run Test live URL and click Request indexing.

Elevate your digital presence

Getting your pages indexed by Google is the first crucial step in your search engine optimization journey.
Fix indexing issues. Let the SEO magic begin.

Try free, see which pages Google hasn't indexed

Free account. Import may take a while for big sites, Google rate-limits Search Console.

See pricing