Inveigled By Design

The art of persuasive design

Rewriting a location in Nginx

For some reason I had a tough time finding this one, so for my own future use and in case it helps anyone else, here’s how you rewrite a url inside an nginx config file.

Calling the old url OldUrl and the url to map to newUrl, here it is:

server {
   listen 80;
   server_name siteName;

    ... (other configuration)

    location oldUrl
    {
         rewrite oldUrl
         newUrl permanent;
     }
}

Not that hard, but hard to find :-(

Leave a Reply

Creative Commons License
Content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 License
Copyright © 2009 Inveigled Software