The X-Robots-Tag is an HTTP response header that tells search engines how to treat a file: whether to index it, whether to follow its links and how much of it to show in results. It does the same job as a meta robots tag, but it travels with the server’s response rather than sitting in the HTML, so it works for PDFs, images, spreadsheets and anything else that has no page head.
How the X-Robots-Tag works
Every time a browser or crawler requests a file, the server sends back headers before the content: the status code, the file type, caching rules and so on. Adding a line such as X-Robots-Tag: noindex to that response tells Google not to keep the file in its index. You can combine directives with commas, and you can address one crawler by name, for example googlebot: noindex, while leaving others unaffected.
It accepts the same directives as the meta tag, including noindex, nofollow, nosnippet, max-snippet, noimageindex and unavailable_after, which removes a file from results after a set date. Common uses look like this:
| Situation | Typical header |
|---|---|
| Old PDF price lists or brochures you do not want found | noindex |
| A whole staging or test site | noindex, nofollow, set at server level (a password is safer still) |
| Images you do not want in Google Images | noimageindex on the pages, or noindex on the image files |
| An event page that should drop out after the date | unavailable_after with the date and time |
The header is set in server configuration (an Apache .htaccess file or Nginx config), through rules at a CDN, or in application code. Rules can target file types, folders or the entire site.
Why it matters
Without it, there is no clean way to keep non-HTML files out of search. UK businesses often have years of PDFs in their uploads folder: superseded price lists, old terms and conditions, a brochure with a previous address. Those can rank, and a customer who lands on an outdated document is misled.
It is also powerful in a way that cuts both ways. A single server rule can noindex every URL on a domain, and because the instruction is invisible in the page source, nobody notices by looking at the site. A staging rule carried across to the live server at launch is one of the quieter ways a site falls out of Google, a problem I treat as part of deindexing checks on any launch.
Common mistakes
- Blocking the file in robots.txt as well. If Google cannot fetch the file, it never sees the noindex header, and the URL can stay indexed from links alone.
- Staging headers shipped to production during a launch or server move.
- Patterns that match too much Such as a rule for one folder that also catches product images.
- Conflicting signals between the header and a meta tag. Google follows the most restrictive instruction, which may not be the one you intended.
- Noindexing PDFs that people genuinely search for Such as a current menu, timetable or safety data sheet.
How to act on it
Check what your server sends. In a browser, open developer tools, go to the Network tab, reload the page and look at the response headers for the main request. From a terminal, curl -I followed by the address shows the headers on their own. In Google Search Console, URL Inspection reports whether indexing is allowed and names the X-Robots-Tag header if that is what blocks it.
Run a crawl that reports response headers across the whole site, then decide which files should be indexed and which should not. Add a header check to every launch and migration checklist. Finding and fixing indexing directives like this is a routine part of the technical SEO work I do.
