Header add Link "<https://%{HTTP_HOST}e%{REDIRECT_PDF_CANONICAL_URL}e>; 
rel=\"canonical\"" env=REDIRECT_PDF_CANONICAL_URL
However, the %{HTTP_HOST} variable doesn't seem to be set.
I don't think you can expect that environment variable to be defined.
Maybe you want to switch the value argument to use expr= syntax
instead so you can use more built-in values.

Do you mean something like this? This doesn't appear to work :-(

SetEnvIf Request_URI "(.+)\.pdf$" PDF_CANONICAL_URL=$1\.pdf
Header always set Link "<%{HTTP_HOST}e%{REDIRECT_PDF_CANONICAL_URL}e>; rel=\"canonical\"" expr=%{REQUEST_URI} =~ m#(.*)pdf$#"

This is from the example provided in the docs

https://httpd.apache.org/docs/2.4/mod/mod_headers.html

Reply via email to