Welcome! Log In Create A New Profile

Advanced

Need help with this rewrite

Posted by Rene2014 
Need help with this rewrite
November 14, 2014 04:32AM
Recently I changed some things on my site that need a 301 redirect.
I would like to do this this as efficient as possible.

old situation:
http://www.sitename.com/old/etc

new situation:
https://sitename.com/new/etc

Right now I'm doing it with the so called 'evil' if statement:

rewrite ^/old(.*)$ /new$1 permanent;
if ($scheme = http) { return 301 https://sitename.com$request_uri; }
if ($host = www.sitename.com) { return 301 https://sitename.com$request_uri; }"

Alhough this works fine, I would rather see the redirect to happen in one step.
Is that possible?
Re: Need help with this rewrite
November 18, 2014 12:39PM
Wow, this forum sure is active!
Re: Need help with this rewrite
November 18, 2014 01:02PM
It is here: http://forum.nginx.org/list.php?2
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 90
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready