Skip to content

Instantly share code, notes, and snippets.

@rcotrina94
Last active November 11, 2015 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcotrina94/341fbf6bb2f285ba551c to your computer and use it in GitHub Desktop.
Save rcotrina94/341fbf6bb2f285ba551c to your computer and use it in GitHub Desktop.
[Nginx] Redirect www to no-www for multiple server names.
server {
listen 80;
server_name ~^(?!www\.)(?<domain>.+)$;
return 301 $scheme://$domain$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment