For files without an HTML head, such as PDFs, you can declare the preferred address with a canonical Link header in the HTTP response. Google supports rel canonical sent this way. It helps when a downloadable file duplicates a web page and you want search engines to treat the page as the main version.
What it looks like
Link: <https://www.example.com/guide/>; rel="canonical"The header is sent by the server along with the file, so you will not find it in any page source.
When it helps
- A PDF version of a page that already exists as HTML.
- Files available at several addresses.
- Documents you want credit to flow to the main page.
Not sure if this is hurting your site?
Get the fixes that matter most, in priority order.
Rules to follow
- Point to a page that returns a 200 and can be indexed.
- Use a full, absolute address.
- Do not combine it with conflicting signals.
Canonical or noindex?
A canonical suggests which version to prefer, while a noindex keeps a file out. For removal use the X-Robots-Tag. The wider logic is in what a canonical tag is and noindex vs canonical vs robots.txt.
How to set it up and check it
Add the header through server rules or your CDN, then check the response with the HTTP header checker. Confirm how Google treats the file in the URL Inspection tool.
Frequently asked questions
Is it as strong as an HTML canonical?
It is a hint in the same way, not a command.
Can I use it for hreflang too?
Yes, headers can carry hreflang, as covered in which hreflang method to use.
Next steps
If you have many duplicate downloads, contact me here for a cleanup plan.
More in this series (HTTP header questions): start with Free HTTP Header Checker, then explore:
- X-Robots-Tag Explained: How to Noindex PDFs and Other Files With HTTP Headers
- Cache-Control Headers: What They Do and How They Affect SEO
- Security Headers and SEO: HSTS, CSP and the Headers Worth Setting
Request received
Thank you! Saad will contact you within the next 24 hours.
Keep an eye on your phone and inbox.
