Skip to content

Instantly share code, notes, and snippets.

@aabril
Created February 8, 2012 17:00
Show Gist options
  • Select an option

  • Save aabril/1771052 to your computer and use it in GitHub Desktop.

Select an option

Save aabril/1771052 to your computer and use it in GitHub Desktop.
nginx rewrite configuration
# nginx configuration
# any access to http://myurl.com/new/blablabla has to load http://myurl.com/old/blablabla without change url
# this is redirecting and changing the url
location ^~ /new/ {
rewrite ^/new/(.*)$ /old/$1 permanent;
}
# how to make the same redirection without change the url?
@perusio
Copy link

perusio commented Feb 8, 2012

This is more in line with the Nginx way of doing things.

location ~* ^/new/(.*)$ {
    return 301 /old/$1;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment