Created
February 25, 2016 11:43
-
-
Save sherred/815a0a81b99484bc4eac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name {{ server_name }}; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
server_name www.{{ server_name }}; | |
return 301 https://{{ server_name }}$request_uri; | |
} | |
server { | |
listen 443 etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the above does all redirects to https://domainname. to redirect everything to https://www. do the following:
change both
return 301 https://$server_name$request_uri;
toreturn 301 https://www.$server_name$request_uri;
change
server_name www.{{ server_name }};
toserver_name {{ server_name }};