On 19/10/19 4:22 pm, Aleksandar Lazic wrote:

Have you tried Lewis suggestion with $arg_id, it looks exactly what you
searching for?

Untested:
location = /test/place {
       if ($arg_id = "2") {
         return 301 https://new.example.com/test/place?$args;
      }
}

I did try but it does not work when the uri has id=1 where id=1 should remain and go to old.example.com.

The solution that works for me is as follows.

if ( $request_uri = "/test/place?id=2" ) {
      rewrite ^ http://new.example.com${uri}?${args}? last;
}

Works with "return" also.

P.V.Anthony
_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to