Rewrite URL to only show value of $_GET argument
Francis Daly
francis at daoine.org
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(.*)$ http://mysite.com/$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 http://mysite.com/$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
/index.php?something=else
/index.php?title=my_test_page&something=other
/index.php
? 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
/my_test_page
? 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.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list