Rewrite undecoded URL

Francis Daly francis at daoine.org
Mon Mar 23 23:23:59 UTC 2015


On Thu, Mar 19, 2015 at 11:52:41AM -0400, youngde811 wrote:

Hi there,

> Hello. We are trying to use the nginx rewrite rule, without the application
> of URL decoding. The relevant portion of our test configuration is:

I'm afraid that I am not sure what response you want nginx to give to
your incoming request.

But if you want to mangle a variable, "map" is usually a good thing
to use.

For example

  map $request_uri $strip_the_slash_p {
    default "";
    ~^/p(?P<one>/.*) $one;
  }

and then you can later use the variable where it is set, such as

  location /p/ {
    return 301 $strip_the_slash_p;
  }

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list