Free auditStart free
GlossaryGlossary · Crawling and indexing

X-Robots-Tag

Use X-Robots-Tag when indexing rules belong in an HTTP response. Learn where it fits, how crawler-specific rules work, and how to verify the header.

3 min
read
2
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

X-Robots-Tag is an HTTP response header that gives search crawlers indexing or snippet instructions for a URL. It is useful for non-HTML files such as PDFs and images, which cannot carry a robots meta tag. A crawler must be able to fetch the URL to read the header.

30-second check

Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Check it

When to use a response header

Use a robots meta tag when you control an HTML page's <head>. Use X-Robots-Tag when the rule belongs to the HTTP response, especially for PDFs, images, and other files without HTML. Google supports the same indexing and serving rules in either place.

To send the header for every PDF on a site, Google's documentation says to add a snippet to the root .htaccess or httpd.conf file on Apache, or to the site's .conf file on NGINX.

Apache and NGINX, from Google's docs
# Apache
<Files ~ "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

# NGINX
location ~* \.pdf$ {
  add_header X-Robots-Tag "noindex, nofollow";
}

Google's docs show server rules that match a group of URLs, such as every .pdf. A broad rule like that applies to every matching response. See noindex for the decision between exclusion, crawl blocking, and canonicalization.

Exclude a PDF from Google Search
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindex
02Checklist

Scope rules carefully

First2
Rules specified without a user agent are valid for all crawlers: X-Robots-Tag: noindex.
Prefix a rule with a crawler name when it should apply only to that crawler, such as X-Robots-Tag: googlebot: noindex.
Next1
You can combine supported rules with commas or send multiple headers. If rules conflict, Google applies the more restrictive instruction.
Then1
A header is not access control. Google's noindex guidance says to password-protect a page to keep it out of Google; noindex tells search engines not to show a URL, and does not restrict who can open it.
03How it works

Verify the response Google can see

For the crawl-control counterpart, see robots.txt. For the page-level version of the same indexing decision, see noindex.

  1. 01

    Request the exact file URL

    Run curl -sIL https://example.com/file.pdf (-L follows redirects) and inspect the final response. Confirm the header is present on the response serving the file.

  2. 02

    Check the status and scope

    Make sure the URL returns the expected file and status, and that a server or CDN rule has not added a broader directive to neighboring URLs.

  3. 03

    Confirm crawl access

    Check robots.txt and authentication. Google says the page must not be blocked by robots.txt and has to be otherwise accessible to the crawler.

  4. 04

    Recheck after deployment

    Test a representative URL for each file type or route pattern. A header added with a pattern rule can affect files that were never part of the intended change.

Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01Can X-Robots-Tag be used on HTML pages?

Yes. Google says any rule that can be used in a robots meta tag can also be specified as an X-Robots-Tag. The header is the option for non-HTML resources, and for HTML you cannot edit.

02Does X-Robots-Tag stop Google from crawling a URL?

No. It is read from the response after Google fetches the URL. Use robots.txt to control crawling; keep the URL crawlable when Google needs to process a noindex header.

03Can I use X-Robots-Tag to hide a private file?

No. It is a search instruction, not access control. Google's guidance for keeping a page out of Google is noindex or password protection; for confidential files, restrict access.

Sources · 2

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • google.com
  1. 01Robots meta tag, data-nosnippet, and X-Robots-Tag specificationsdevelopers.google.com · checked 2026-10-24
  2. 02Block Search indexing with noindexdevelopers.google.com · checked 2026-10-24
Free · 2 minutes

Know the term. Now check your site.

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly