Skip to content

Instantly share code, notes, and snippets.

@jonalvarezz
Created July 22, 2016 16:28
Show Gist options
  • Save jonalvarezz/0d095060e61802c777484f753863efe9 to your computer and use it in GitHub Desktop.
Save jonalvarezz/0d095060e61802c777484f753863efe9 to your computer and use it in GitHub Desktop.
Nginx Redirection

How to create NGINX redirection

This is a way, recommended way by Nginx when creation redirections. i.e. you want to redirect from www to non-ww

server {
  server_name www.mydomain.tld;
  return 301 $scheme://mydomain.tld$request_uri;
}

server {
  server_name mydomain.tld
  # ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment