Skip to content

Instantly share code, notes, and snippets.

@kphrx
Last active September 13, 2016 10:24
Show Gist options
  • Save kphrx/b96c90d382a6bc0dfda6df30a09dd46a to your computer and use it in GitHub Desktop.
Save kphrx/b96c90d382a6bc0dfda6df30a09dd46a to your computer and use it in GitHub Desktop.
## www to non-www redirect ##
server {
## all www sub-domain ##
server_name ~^www\.(.*\.example.com)$;
## redirect to non-www sub-domain ##
return 301 $scheme://$1$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment