Welcome! Log In Create A New Profile

Advanced

Re: Adding "Link" Header

Max
February 09, 2012 06:32PM
10 февраля 2012, 02:44 от "jwilson" <nginx-forum@nginx.us>:
> To avoid SEO issues on my subdomains, I need to add a "Link" header to
> support Google's canonical header. The format is as follows (from
> http://googlewebmastercentral.blogspot.com/2011/06/supporting-relcanonical-http-headers.html):
>
> Link: http://www.example.com/white-paper.html; rel="canonical"
>
> So, the add_header command would need to reference $uri, but it also
> needs a semi-colon and double quotes. How can I add this header to my
> config?

location ~* ^/(.*)(\.pdf)$ {
add_header Link "<$scheme://$host:$server_port/$1.html>; rel=\"canonical\"";
}

You can use $http_host instead of $host:$server_port, but if you get
a request without the Host header, $http_host will be empty.

Max
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Adding "Link" Header

jwilson February 09, 2012 05:43PM

Re: Adding "Link" Header

António P. P. Almeida February 09, 2012 06:28PM

Re: Adding "Link" Header

Max February 09, 2012 06:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready