I want rewrite a uri to itself without querystring, I tried
rewrite .+ $uri permanent;
but it rewrite to the original uri, with querystring unstripped.
After googled, I try
rewrite .+ $uri? permanent;
and it works correctly.
But why?
I want rewrite a uri to itself without querystring, I tried
rewrite .+ $uri permanent;
but it rewrite to the original uri, with querystring unstripped.
After googled, I try
rewrite .+ $uri? permanent;
and it works correctly.
But why?
Hello!
On Fri, Jul 06, 2012 at 10:44:15PM +0800, 任晓磊 wrote:
I want rewrite a uri to itself without querystring, I tried
rewrite .+ $uri permanent;
but it rewrite to the original uri, with querystring unstripped.After googled, I try
rewrite .+ $uri? permanent;
and it works correctly.But why?
Because it’s how it’s expected to work. By default the “rewrite”
directive preserves query string, and even if you write arguments
in a replacement string - they are added before original query
string which is still preserved. Trailing question mark is an
explicit flag that you don’t want to preserve query string.
Maxim D.
On 2012-7-7, at 0:23, Maxim D. [email protected] wrote:
Hello!
Because it’s how it’s expected to work. By default the “rewrite”
directive preserves query string, and even if you write arguments
in a replacement string - they are added before original query
string which is still preserved. Trailing question mark is an
explicit flag that you don’t want to preserve query string.
Thank you. I was too careless to look though the wiki.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs