<div dir="ltr">rewrite and location matching do not include query strings. As a quick workaround, I believe you could do something like this:<div><br></div><div>if ($request_uri = "<span style="font-size:12.8px">/abc/xyz/def.php?Id=13") { return 301 "</span><a href="http://www.example.com/fhu/foo" rel="noreferrer" target="_blank" style="font-size:12.8px">http://www.example.com/fhu/foo</a><span style="font-size:12.8px">"; }</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Be aware that this matches the request exactly - query string parameters must be in the same order and case.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 29, 2017 at 9:20 PM, AjaySawant <span dir="ltr"><<a href="mailto:nginx-forum@forum.nginx.org" target="_blank">nginx-forum@forum.nginx.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am trying to redirect a query string to url and I am using like this but<br>
it is somehow not working. Can somebody help?<br>
<br>
rewrite ^/abc/xyz/def.php?Id=13 <a href="http://www.example.com/fhu/foo" rel="noreferrer" target="_blank">http://www.example.com/fhu/foo</a> permanent;<br>
rewrite ^/abc/xyz/def.php?Id=14 <a href="http://www.example.com/fhu/bar" rel="noreferrer" target="_blank">http://www.example.com/fhu/bar</a> permanent;<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,275218,275218#msg-275218" rel="noreferrer" target="_blank">https://forum.nginx.org/read.<wbr>php?2,275218,275218#msg-275218</a><br>
<br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>