Nginx redirect quey string to url

Richard Stanway r1ch+nginx at
Thu Jun 29 23:22:09 UTC 2017

rewrite and location matching do not include query strings. As a quick
workaround, I believe you could do something like this:

if ($request_uri = "/abc/xyz/def.php?Id=13") { return 301 ""; }

Be aware that this matches the request exactly - query string parameters
must be in the same order and case.

On Thu, Jun 29, 2017 at 9:20 PM, AjaySawant <nginx-forum at>

> I am trying to redirect a query string to url and I am using like this but
> it is somehow not working. Can somebody help?
> rewrite ^/abc/xyz/def.php?Id=13 permanent;
> rewrite ^/abc/xyz/def.php?Id=14 permanent;
> Posted at Nginx Forum:
> php?2,275218,275218#msg-275218
> _______________________________________________
> nginx mailing list
> nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list