rewrite or return for simple redirection

neubyr neubyr at gmail.com
Fri Nov 21 19:21:40 UTC 2014


I am trying to understand which option would result in more efficient HTTP
redirection. I am trying to redirect ^/address page to ^/contact page.

Option 1:
rewrite ^/address /contact permanent;

Option 2:
location ~ ^/address {
  return 301 $scheme://$host/contact
}

Which option should be preferred? Both options involve regex and I am not
sure which one will be faster. Are there any other better options?

-N
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141121/ba4a3157/attachment.html>


More information about the nginx mailing list