nginx redirects and rewrites

Posted by ptheofan on Server Fault See other posts from Server Fault or by ptheofan
Published on 2013-10-23T21:12:24Z Indexed on 2013/10/23 21:55 UTC
Read the original article Hit count: 159

Filed under:
|
|
|

I'm closing a website but want to maintain a couple of urls working plus a static html file to serve as index. All old urls should redirect to root (/) except a couple of chosen locations.

Here's an example of what I need to do

All should give 301 permanent to /
http:://www.domain.tld/whatever/anything/realy  == 301 ==> http://www.domain.tld
http:://www.domain.tld/blabla  == 301 ==> http://www.domain.tld
http:://www.domain.tld/ == 301 ==> http://www.domain.tld

except for
http://www.domain.tld/special.html == serve ==> special.html


root should serve the defailt file (as specificed in index)
http:://www.domain.tld  == serve => somefile.html

© Server Fault or respective owner

Related posts about nginx

Related posts about mod-rewrite