How to do location /test/place?id=2
Patrick
201904-nginx at jslf.app
Fri Oct 18 01:03:11 UTC 2019
On 2019-10-18 01:01, P.V.Anthony wrote:
> Currently have the following url,
>
> https://old.example.com/test/place?id=1
> https://old.example.com/test/place?id=2
> https://old.example.com/test/place?id=3
>
> Need to redirect only id=2 to another url.
This looks like a gradual migration of content to a new server. Try
using `rewrite' instead of `return'?
map "$uri?$args" $is_new_site {
/test/place?id=2 1;
default 0;
}
server {
...
if ( $is_new_site ) {
rewrite ^ http://new.example.com/${uri}?${args}? last;
}
...
# all the locations go here
}
Patrick
More information about the nginx
mailing list