Rewrite URL to only show value of $_GET argument

Francis Daly francis at
Tue Sep 10 16:46:57 UTC 2013

On Mon, Sep 09, 2013 at 08:23:36AM -0500, Andrew Martin wrote:

Hi there,

> If I use this line:
> rewrite ^/index\.php(.*)$$arg_title? redirect;
> /index.php?title=my_test_page redirects to /my_test_page

That's what you asked for initially; I'd probably spell it as

  location = /index.php {
    return 302$arg_title;

to make it clear what exactly is happening, and which might point out
the parts you didn't specify:

what should happen if I ask for any of


? With the above code, the second will possibly redirect the way you want,
and the others probably won't.

Also, what should happen when I ask for


? I will do that immediately after you redirect me there.

If you can describe the complete behaviour you want, the nginx
configuration needed to achieve it may become clear.

Francis Daly        francis at

More information about the nginx mailing list