The X-Robots-Tag is the header version of the robots meta tag. Instead of sitting in a page’s HTML, it is sent by the server alongside the response, so it can control how search engines index files that have no HTML at all: PDFs, Word documents, images, videos and feeds.
Any rule you can put in a robots meta tag also works in the header, according to Google’s robots meta tag documentation.
What it looks like
A response that tells all crawlers not to index the file:
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindex
Several rules in one header, or several headers, both work:
X-Robots-Tag: noindex, nofollow
X-Robots-Tag: googlebot: noindex
X-Robots-Tag: unavailable_after: 2026-12-31
The second line applies only to Googlebot. A rule with no user agent in front applies to every crawler. When rules conflict, Google follows the more restrictive one.
Meta tag versus header
| Robots meta tag | X-Robots-Tag header | |
|---|---|---|
| Where it lives | In the page’s <head> |
In the HTTP response |
| Works on | HTML pages | Any file type |
| Who usually sets it | SEO plugin or CMS | Server, CDN or hosting config |
| Easy to see | View source | Browser dev tools (Network tab) or a header checker |
| Apply to many files at once | Per page or template | By pattern, such as every .pdf |
When we use it
- PDFs that duplicate a web page. Brightside Dental had a printable new-patient guide as both a page and a PDF, and the PDF kept outranking the page. A
noindexheader on the PDF sorted it. - Staging or development copies of a site, set at the server level so nothing slips through.
- Internal search results, feeds and generated files that should never be indexed.
- Images you do not want in image search, with
noimageindexon the page ornoindexon the image file.
Setting it on a server
Apache (.htaccess or the server config), for every PDF:
<Files ~ "\.pdf$">
Header set X-Robots-Tag "noindex, nofollow"
</Files>
NGINX:
location ~* \.pdf$ {
add_header X-Robots-Tag "noindex, nofollow";
}
Common mistakes
- Blocking the same URL in robots.txt. Google only sees the header when it fetches the file. If robots.txt blocks the URL, the header is never read, and the file can still be indexed from links. To remove something, allow crawling and send
noindex. - A site-wide
noindexleft over from staging. It is invisible in the page source, so it is easy to miss after a launch. It is one of the first things we check when a new site gets no traffic. - Setting the rule twice with different values, once in a plugin and once on the server. The stricter one wins, which may not be the one you meant.
How to check
URL Inspection in Search Console reports when indexing is blocked by a noindex in the X-Robots-Tag header. RankThat’s Site Audit lists pages blocked from Google with noindex, whether it comes from the meta tag or the X-Robots-Tag header, so you can confirm each one is intended. See noindex for the wider picture.