Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save janneleppanen/1edb6389c95d0f60deaef2db7e50255f to your computer and use it in GitHub Desktop.
Save janneleppanen/1edb6389c95d0f60deaef2db7e50255f to your computer and use it in GitHub Desktop.
NGINX redirect sub folder to new subdomain
# redirect sub folder to new sub domain
location ~ /sub {
rewrite ^(/sub/)(.*)$ http://sub.domain.com/$2;
}
# redirect main site to new domain
location ~ / {
return 302 http://domain.com$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment