using two if statements together in nginx conf

Andy Triboletti andy.triboletti at gmail.com
Thu Mar 1 00:23:45 MSK 2007


On 2/28/07, Roxis <roxis at list.ru> wrote:
>
> On Wednesday 28 February 2007, Andy Triboletti wrote:
> > 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.
>
> if ($http_referer ~ "^.*bob\.com.*$") {
>     rewrite "^.*12345.*$" /disabled break;
> }
>
> if ($http_referer ~ "^.*andy\.com.*$") {
>     rewrite "^.*987.*$" /disabled break;
> }



Unfortunately that's not working for me because the 12345 and 987 are query
params on a flash .swf file and they're not showing up in the rewrite test
for the url.  Thanks for the suggestions so far though!

Here is some of the debug notice output when trying to do the rewrites:
2007/02/28 11:11:28 [notice] 2989#0: *881 "^.*andy\.com.*$" matches "
http://andy.com/", client: 127.0.0.1, server: localhost, URL:
"/thing.swf?thing_id=987", host: "localhost", referrer: "http://andy.com/"
2007/02/28 11:11:28 [notice] 2989#0: *881 "^.*987.*$" does not match
"/thing.swf", client: 127.0.0.1, server: localhost, URL:
"/thing.swf?event_id=987", host: "localhost", referrer: "http://andy.com/"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070228/4acf2286/attachment.html>


More information about the nginx mailing list