# Problem re-writing using query strings

**URL:** <https://www.ruby-forum.com/t/problem-re-writing-using-query-strings/193553>\
**Category:** NGINX\
**Created:** [August 19, 2010, 4:41pm UTC](https://www.ruby-forum.com/t/problem-re-writing-using-query-strings/193553 "2010-08-19T16:41:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evms](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/34f0e0/32.png) [@evms](https://www.ruby-forum.com/u/evms)\
**Post date:** [August 19, 2010, 4:41pm UTC](https://www.ruby-forum.com/t/problem-re-writing-using-query-strings/193553/1 "2010-08-19T16:41:59Z")

</div>

Hi,

I’m basically trying to do this:

rewrite /x.php?a=1 to /x.php?b=2.

So, I have

location /x.php {  
set $args ‘b=2’;  
rewrite ^ /x.php  
}

This produces a loop.

How can I basically do this? Re-write from same URL to same URL with  
different query strings?

Posted at Nginx Forum:

> **[Problem re-writing using query strings](https://forum.nginx.org/read.php?2,121321,121321#msg-121321)**
>
> Hi, I'm basically trying to do this: rewrite /x.php?a=1 to /x.php?b=2. So, I have location /x.php { set $args 'b=2'; rewrite ^ /x.php } This produces a loop. How can I basically do this?
