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.
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.
Is this costing your site traffic?
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
- Free audit in 60 seconds
- Fixes drafted for your review
- ChatGPT, Perplexity, Gemini and AI Overviews tracked
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
- Re-check after big site changes
- Keep this page for reference
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
- Follow the steps below
- Top-traffic pages first
- Check again in a month
3 parts, 3 minutes.
When to use a response header
<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
<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.
HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindexScope rules carefully
X-Robots-Tag: noindex.X-Robots-Tag: googlebot: noindex.noindex tells search engines not to show a URL, and does not restrict who can open it.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.
- 01
Request the exact file URL
Run
curl -sIL https://example.com/file.pdf(-Lfollows redirects) and inspect the final response. Confirm the header is present on the response serving the file. - 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.
- 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.
- 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.
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.
Every fact, linked and dated.
google.com
- 01Robots meta tag, data-nosnippet, and X-Robots-Tag specificationsdevelopers.google.com · checked 2026-10-24
- 02Block Search indexing with noindexdevelopers.google.com · checked 2026-10-24
Keep learning
All glossaryKnow the term. Now check your site.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.
- 46 fixes shipped without a ticket Brightpipe
- +212% organic clicks in 90 days Ledgerly