Need help with a 301 rewrite

Mr. Jinx

Verified User
Joined
May 5, 2006
Messages
61
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?
 
Back
Top