Preferred way to do redirects (rewrite or return)
Valentin V. Bartenev
vbart at nginx.com
Mon Sep 23 20:45:45 UTC 2013
On Tuesday 24 September 2013 00:38:53 justin wrote:
> 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?
>
Faster:
location =/help { return 301 https://support.mydomain.com; }
location =/help/ { return 301 https://support.mydomain.com; }
wbr, Valentin V. Bartenev
More information about the nginx
mailing list