A PDF cannot carry an HTML <meta name="robots"> element in its document head. If a public PDF should stay out of Google Search, return X-Robots-Tag: noindex in the HTTP response for the PDF. Google must be able to fetch the URL; a robots.txt block can hide the instruction it needs to read.
Decide what you need to control
These three goals need different mechanisms:
| Goal | Appropriate mechanism | What it does not do |
|---|---|---|
| Keep the file public but out of Google results | X-Robots-Tag: noindex | Does not guarantee immediate removal |
| Keep confidential material private | Authentication, authorization or another access control | noindex does not prevent direct access |
| Reduce crawler requests | A suitable robots.txt rule | Does not reliably prevent a URL from appearing in results |
Google documents X-Robots-Tag for non-HTML resources such as PDFs, images and videos. The header controls whether a fetchable resource may be indexed or presented. It does not change HTTP access, and it does not retroactively erase a stored search result. The robots.txt glossary distinguishes crawl access from indexing; the HTTP headers glossary explains where this instruction is delivered.
Check the public GET response
A rule in NGINX, Apache, a CMS or a CDN does not prove that the public URL receives it. Check the actual GET path, including redirects, status, content type and X-Robots-Tag:
bashcurl -sS -L --max-redirs 10 --range 0-0 -D - -o /dev/null \
-w '\nfinal=%{url_effective} status=%{http_code} redirects=%{num_redirects}\n' \
https://example.com/downloads/manual.pdf
-D - prints the response-header blocks, -L follows HTTP redirects, and -w reports the final URL. --range 0-0 requests only the first byte if the server supports byte ranges; confirm that it returns 206 Partial Content. If the server ignores the range header and returns 200, it may still transfer the full file. /dev/null discards only the local copy. A HEAD request is faster but does not prove that GET returns the same headers. On Windows, you may need curl.exe and NUL as the output target.
Inspect every hop separately. A download URL might return 302 to a different file. A header on that redirect is not proof that the final PDF endpoint returns the same instruction. Confirm that the destination is actually a PDF with the expected content type, not a sign-in page, HTML error or different file.
Scope the rule carefully
Google's examples show how to set a rule for all PDFs or an individual file. For one file, Apache could be configured like this:
apache<Files "manual.pdf">
Header set X-Robots-Tag "noindex"
</Files>
A matching NGINX rule can target an exact path:
nginxlocation = /downloads/manual.pdf {
add_header X-Robots-Tag "noindex";
}
Adapt the syntax and scope to your server configuration. A filename-extension rule such as .pdf may also match files that should remain indexable. Test at least one PDF to exclude and a control PDF that should stay visible. Headers from the origin, proxy and CDN may be combined or conflict; record what the public endpoint sends before removing one configuration.
A header can apply to all crawlers or name a particular user agent. Use that exception only when different rules are deliberate. Google applies the more restrictive robots rule when instructions conflict. If a file is unexpectedly excluded, record every X-Robots-Tag on the final response and trace which layer added each value. Adding another index header will not resolve the conflict while another service still returns noindex.
Example: redirect, CDN and cache
Suppose /downloads/manual.pdf returns 302 to /files/manual-v3.pdf. The final response is 200 and application/pdf, but only the first response has X-Robots-Tag: noindex. The next step is not to add a robots.txt block. Check which rule applies to the final PDF response, whether a CDN is serving an older version, and whether the redirect is intended. Record the request URL, time, status, Location, final URL and headers from both responses.
This is a diagnostic example, not a finding from a real website. A test on one file or directly against the origin does not prove that every path, cache location or time behaves the same way. If different subdomains or storage systems serve PDFs, test each variant separately.
When the header is correct but the result remains
Follow a fixed sequence before adding more directives:
- Check the exact URL: Compare the URL shown in search with the URL requested by your GET test. A different host, language path, file version or download endpoint with query parameters can return a different response. Testing
/manual.pdfsays nothing about/de/manual.pdf. - Record every delivery layer: Inspect the redirect response and the final PDF response. Check whether the origin, proxy and CDN return different versions. A correct header in a server repository does not prove that the public variant delivers it.
- Keep the file crawlable: Google can read the instruction only if it can fetch the resource. Check the applicable
robots.txtrule and the public response. URL Inspection in Search Console can add evidence about Google's observed state, but it does not replace the HTTP test. - Separate the timelines: If the header is correct now, the search result may still reflect an earlier crawl. A successful fetch today proves the current endpoint, not that Google has already processed the new response.
Named crawlers also need deliberate handling. A header such as X-Robots-Tag: googlebot: noindex targets a specific crawler; a general noindex instruction has a different scope. Use crawler-specific directives only when the difference is intended and documented. After changing the rule, test both a PDF that should be excluded and a control file that should remain indexable. This catches an overly broad rule on a download directory.
When searching server logs for Googlebot, the User-Agent text alone does not prove a request is genuine. A request with curl -A Googlebot only tests how your rule responds to that header. To attribute real requests, Google recommends checking the source IP with reverse DNS followed by forward DNS, or matching it against Google's published IP ranges. The public PDF response still matters for the noindex test: it shows which headers actually arrive on a normal request.
For a large file library, keep a small verification table with the URL, expected visibility, response status, Content-Type, final destination and every robots header. That makes the check repeatable after CDN or CMS changes. It does not replace a later crawl or review of the search result.
Separate indexing, access and removal
Google has to fetch the file again to see the header. If robots.txt still disallows the PDF, Google cannot read noindex. Links can still reveal the URL, which may then appear in results without its normal content. For a public file, allow the fetch until the crawler can process the instruction. For confidential content, establish access control first.
For an urgent result, Google's Removals tool can be a temporary measure; Google says requests last about six months. For a permanent removal, remove the file, protect it, or keep an accessible noindex instruction in place. Search Console provides additional diagnostic reports. The tool does not make a public PDF private. Google's documentation on HTTP status codes and crawling and the guide to crawled but currently not indexed URLs answer other status questions; neither replaces the header test.
A concise acceptance check records the expected file, final status and URL, Content-Type, every robots header, and a control file. Search Console and URL Inspection can add evidence about Google's state at a particular time. Inspect the exact URL and its variants: a correct header can already be live before Google fetches and processes the file again. A successful GET does not prove that the exclusion has taken effect in Search.
For adjacent crawler rules, see the guide to AI crawlers and robots.txt. The redirects glossary and a focused technical SEO audit help place status and destination checks in the wider delivery path.