Home /nginx /301 redirect a specific location with NGINX /

301 redirect a specific location with NGINX

2:17 am, April 23, 2017

Original Post Date: 5:34 am, August 8, 2014

Just add this to your nginx server block

location = /the/directory/ {
return 301 /the/new/location/;
}

had to use this as i was migrating from wordpress links. You can also redirect to images or any file as well as directories.

e.g: http://www.kruxor.com/general/first-thing-that-i-saw-in-google-reader-play-barney-stinson-awesome/attachment/barney-stinson-awesome-quote/