Forum: NGINX Preferred way to do redirects (rewrite or return)

2974d09ac2541e892966b762aad84943?d=identicon&s=25 justin (Guest)
on 2013-09-23 22:39
(Received via mailing list)
What is the preferred way to do redirects? I know of two solutions:

rewrite "^/help/?$" https://support.mydomain.com permanent;

or

location ^/help/?$ {
  return 301 https://support.mydomain.com;
}

I think I like using a location block and a return statement. Which is
faster though and the standard?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,243075,243075#msg-243075
40b4c848b8fcd63b0cb60b9d170c3a77?d=identicon&s=25 Valentin V. Bartenev (Guest)
on 2013-09-23 22:46
(Received via mailing list)
On Tuesday 24 September 2013 00:38:53 justin wrote:
> I think I like using a location block and a return statement. Which is
> faster though and the standard?
>

Faster:

  location =/help { return 301 https://support.mydomain.com; }
  location =/help/ { return 301 https://support.mydomain.com; }


 wbr, Valentin V. Bartenev
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.