SEO

X-Robots-Tag

Also called X-Robots-Tag HTTP header

An HTTP header that tells search engines whether to index a file, including PDFs and images that cannot carry a meta tag.

Quick facts: X-Robots-Tag

Category
SEO
Also called
X-Robots-Tag HTTP header
Level
Advanced
Affects
Indexing of PDFs, images and other files, staging sites, site-wide indexability
Where to see it
Browser developer tools, curl, Search Console URL Inspection, Screaming Frog or other crawlers
In this article4
  1. How the X-Robots-Tag works
  2. Why it matters
  3. Common mistakes
  4. How to act on it

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:

SituationTypical header
Old PDF price lists or brochures you do not want foundnoindex
A whole staging or test sitenoindex, nofollow, set at server level (a password is safer still)
Images you do not want in Google Imagesnoimageindex on the pages, or noindex on the image files
An event page that should drop out after the dateunavailable_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.

Do and do not

Do

  • Use it to keep outdated PDFs and files out of search
  • Check response headers after every launch or server move
  • Leave noindexed files crawlable so the header is seen

Do not

  • Block a file in robots.txt and expect a noindex header to work
  • Copy staging server rules to the live site
  • Write broad rules without testing which URLs they match

Questions people ask about this

What is the difference between X-Robots-Tag and the meta robots tag?

They accept the same instructions, but the meta robots tag sits in the HTML head of a page, while the X-Robots-Tag is sent in the HTTP header of the server's response. That makes the header the only option for files without HTML, such as PDFs and images, and convenient for applying a rule to many URLs at once.

How do I noindex a PDF?

Add an X-Robots-Tag: noindex header to the response for that PDF, through your server configuration, CDN rules or a plugin that supports headers. Make sure the PDF is not blocked in robots.txt, or Google will not see the header. If the file is already indexed, request removal in Search Console for a faster result while the header takes effect.

Can the X-Robots-Tag remove my whole site from Google?

Yes, if a noindex header is applied site-wide. This usually happens when a staging rule is copied to the live server. Because the header is not visible in the page, check it with URL Inspection in Search Console or curl after every launch or server change.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.