Skip to content

Instantly share code, notes, and snippets.

@perusio
Created February 9, 2012 23:33
Show Gist options
  • Save perusio/1784254 to your computer and use it in GitHub Desktop.
Save perusio/1784254 to your computer and use it in GitHub Desktop.
Nginx support for rel="canonical" HTTP headers
## As explained here: http://googlewebmastercentral.blogspot.com/2011/06/supporting-relcanonical-http-headers.html
## This is the add_header incantation to make it work.
add_header Link "<$scheme://$http_host$request_uri>; rel=\"canonical\"";
@mikeninerbravog
Copy link

mikeninerbravog commented Apr 25, 2018

Thank you. This saved a lot of time work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment