using two if statements together in nginx conf

Andy Triboletti andy.triboletti at gmail.com
Wed Feb 28 06:04:28 MSK 2007


On 2/27/07, Roxis <roxis at list.ru> wrote:
>
> On Wednesday 28 February 2007, Andy Triboletti wrote:
> > location = /things {
> >     if ($http_referer ~* ".*bob.com.*" && $args ~* "12345")    {
> >         rewrite ^/things$ /thing.disabled break;
> >
> >     }
>
> this should work:
>
> if ($http_referer !~* ".*bob.com.*") {
>     break;
> }
>
> if ($args ~* "12345") {
>     rewrite ^/things$ /thing.disabled break;
> }


Thanks, that did work for that case.

What if I want to redirect when the referer is bob.com with args of 12345
and also redirect if referer is andy.com with args of 987?  I tried having
two location ~* things {} blocks ,but it is not processing both.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070227/c0ce06ce/attachment.html>


More information about the nginx mailing list