Canonical URL for PDF

(Mitch Kerry) #1

Hi all

Has anyone had any success setting a canonical URL for PDF files?
We have both the www and non-www urls indexing.
Can it be done with a Send HTTP Header trigger?
If so, how do I set up the request?


(David Schoen) #2

Is Matrix serving both the www and non-www sites?

It might be better to pick one of them as canonical for the entire site and set up a generic redirect for the entire domain.

(Mitch Kerry) #3

Thanks @dschoen, that is what we want in the end.
At what level can I set the domain redirect, can that be done in Matrix?


(David Schoen) #4

In Matrix it can be done with a site asset that just has the non-canonical domains and a redirect asset.

E.g if is to be canonical, a new site asset can be created with,, etc applied.

Create a child redirect asset and set the asset location to the canonical site asset. Make it a permanent redirect and set the URL Suffix to %globals_server_REQUEST_URI%.

On the details screen of site asset set the index, not found and archived pages to the redirect asset.

Make it live and test using an incognito browser window.

This unfortunately won’t redirect __data URLs that still exist as they are served directly, but updating all the links is often enough. If you actually need to redirect __data URLs that are not 404s over to the canonical domain then it currently needs to be done outside of Matrix (ideally in the CDN/proxy in front).

(Mitch Kerry) #5

Thanks @dschoen, a great strategy.
Unfortunately the pdfs are all _data.
I’ll have to put in a request.