Created
June 24, 2015 21:58
-
-
Save ottonet/7c98f7328677e1d22ea2 to your computer and use it in GitHub Desktop.
automatic nginx 301 www to non-www
This file contains hidden or 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 ~^((?<subdomain>.*)\.)(?<domain>[^.]+)\.(?<tld>[^.]+)$; | |
return 301 $scheme://${domain}.${tld}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment