Redirecting part of URL in Nginx

Posted by Maca on Stack Overflow See other posts from Stack Overflow or by Maca
Published on 2014-08-20T01:35:09Z Indexed on 2014/08/20 10:20 UTC
Read the original article Hit count: 200

Filed under:
|

Trying to move my blog to a new site and I want to redirect some urls. I use nginx.

https://blogurl.com/news/2014-08-19/post-3451/mt-preview-33e2742af1eb.php

The /news/2014-08-19/post-3451/mt-preview-33e2742af1eb.php part would be always moving.

Redirect to below:

https://blogurl.com/content/news/2014-08-19/post-3451/mt-preview-33e2742af1eb.php

I basically want to insert /content/ after https://blogurl.com and so far I have

rewrite ^(.*)$ /content/ break;

But my issue is my CMS sits on the same directory level

https://blogurl.com/mt/admin

and if I simply apply the rewrite above my CMS address would move too. How could I prevent this.

© Stack Overflow or respective owner

Related posts about redirect

Related posts about nginx