redirect from www to sub-page

Igor Sysoev is at rambler-co.ru
Thu Jan 22 21:37:57 MSK 2009


On Thu, Jan 22, 2009 at 06:23:24PM +0100, Marcin Kasperski wrote:

> >         location = / {
> >              rewrite ^   http://www.example.com/new_location;
> >         }
> 
> Out of curiosity: does there exist any noticeable difference between
> this and
> 
>     rewrite ^/$ /new_location;
> 
> ?

The

     rewrite ^/$ /new_location;

will run regex "^/$" for every request, while

     location = / {
         rewrite ^   http://www.example.com/new_location;

is just simple comparison with "/". And the regex "^" will be run only
for "/" requests.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list