What the X-Robots-Tag Is
The X-Robots-Tag is a field in the HTTP response with which a server tells search engines what they may do with the file just requested: index it or not, follow its links or not, keep a copy or not. It is the same conversation as the meta robots tag, only held somewhere else.
That somewhere else is the whole difference. The meta tag lives inside the HTML, so it exists only where HTML exists. The header travels ahead of the file, whatever type it is, and is therefore the only route to a PDF, an image or a downloadable file.
It is worth separating it straight away from the other instruction it gets confused with. robots.txt governs whether the crawler may request the file; the X-Robots-Tag governs what it does with it afterwards. Two different moments, and that distinction explains almost every mistake further down.
The X- in the name recalls that it began as a header proposed outside the standard, like so much else from the web's early years. The large search engines honour it today, but it remains a request rather than an order: any client may ignore it without breaking a rule.
From which follows something worth being clear about before going on. Everything this header does happens on the reader's side, not the file's. It does not encrypt it, move it or delete it: it only changes what a search engine decides to do with a copy it already has in front of it.
