Creative agency glossarySEO and Analytics

X-Robots-Tag

The X-Robots-Tag is an HTTP response header that gives search engines indexing instructions for a URL, doing the job of a robots meta tag for files that have no HTML, such as PDFs, images and videos.

What is the X-Robots-Tag?

The X-Robots-Tag is a line in the HTTP headers a server sends with a response, carrying the same directives as the robots meta tag: noindex, nofollow, noarchive, nosnippet, noimageindex, unavailable_after and the rest. A robots meta tag lives in the HTML of a page. The X-Robots-Tag lives outside the content, in the header, so it can be attached to anything the server delivers, including PDFs, images, videos, spreadsheets and plain text files that have no head section to put a tag in.

It can also be applied to HTML pages, and is often used that way when the rule needs to cover a whole folder or file type at once. A single server configuration line can noindex every PDF on a site, which would otherwise take a change to each file or be impossible.

Why it matters

Why the X-Robots-Tag matters

Sites leak through their files. Internal documents, draft PDFs, old brochures, high-resolution images, exported spreadsheets: all of them are indexable, and many end up in search results because nobody thought of them as pages. The X-Robots-Tag is the only way to keep them out without deleting them or hiding them behind a login. It is also the correct tool for the job that robots.txt is often misused for: robots.txt stops crawling, which does not stop indexing, while a noindex header stops indexing directly.

It matters at scale. A site with thousands of media files or a staging environment can set a single rule at the server and be sure nothing slips through, instead of maintaining tags file by file.

In practice

How the X-Robots-Tag works in practice

  1. 01

    The header is set in the server configuration or the application. On Apache it is a line in .htaccess matching a file pattern; on Nginx a directive in the server block; on a CDN or edge platform a rule on the response. A typical rule sends "X-Robots-Tag: noindex" for every URL ending in .pdf, or "noindex, nofollow" for an entire staging subdomain. Content management systems and SEO plugins can set it for specific URLs or types.

  2. 02

    Testing is essential, because a header is invisible in the page. The response headers are checked with browser developer tools, curl or the URL Inspection Tool, which reports the directives it found. The rule has to allow crawling: a file blocked in robots.txt will never have its header read, so the noindex has no effect. And it is audited, because a header set broadly during a migration, such as noindex on everything, has taken sites out of the index when it was forgotten at launch.

Watch out

What people get wrong about the X-Robots-Tag

Combining it with a robots.txt block. If the crawler cannot fetch the file, it cannot see the header, and the file may stay indexed from links alone. The other mistake is the inverse: forgetting that it exists. Sites with a perfect set of meta tags on their pages are surprised to find their PDFs ranking, because nobody applied the equivalent rule to files. And the launch-day error is common enough to be a cliche: a staging rule of noindex that ships to production and quietly removes the site from search.

Questions

People also ask

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

They carry the same directives. The meta tag sits in a page's HTML; the X-Robots-Tag is an HTTP header sent by the server, so it works for files without HTML, such as PDFs and images, and can be applied to whole folders or file types in one rule.

Can X-Robots-Tag be used to noindex PDFs?

Yes, and it is the standard way. A server rule sends "X-Robots-Tag: noindex" with every PDF response, keeping them out of search results without deleting them. The PDFs must remain crawlable for the header to be read.

Does X-Robots-Tag work if the URL is blocked in robots.txt?

No. Robots.txt prevents the crawler from fetching the URL, so it never sees the header. To noindex a file with the X-Robots-Tag, allow it in robots.txt and let the header do the work.

Next to it in the glossary

  1. 200 (OK) Response CodeA 200 OK response code is the server's confirmation that a request succeeded and the page was delivered as asked.
  2. 301 RedirectA 301 redirect is a permanent instruction that sends browsers and search engines from an old URL to a new one, carrying the old page's ranking signals with it.
  3. 302 RedirectA 302 redirect is a temporary instruction that sends visitors from one URL to another while telling search engines the original address will return.
  4. 304 Not ModifiedA 304 Not Modified response tells a browser or a crawler that the page has not changed since it was last fetched, so the cached copy can be used instead.
  5. 307 Temporary RedirectA 307 Temporary Redirect sends a visitor to a different URL for now, while guaranteeing that the request is repeated exactly as it was made.
  6. 403 ForbiddenA 403 Forbidden error means the server understood the request but refuses to serve the page, usually because the visitor does not have permission to see it.

Every SEO and Analytics term →

In the work

Where it shows up

All our creations →

From the journal

Read around it

The journal →

Talking the talk is one thing

We make the work.

RIOT is a creative agency and production studio in New York. Strategy, brand, film, photography, design and the campaigns that carry them, made by one team. A few lines is enough to start: we read every brief the same day.

    Footage