Welcome! Log In Create A New Profile

Advanced

Re: Best way to get the $request_uri without the starting slash

December 20, 2011 04:46AM
On Tue, Dec 20, 2011 at 04:36:49AM -0500, WheresWardy wrote:
> Thanks, that's exactly what I was looking for.
>
> The $1 didn't work however, nginx complained about it being an
> unreferenced variable, so I modified it to look like the examples in the
> documentation (maybe you can't reference pattern matches numerically
> like elsewhere in the config?):
>
> map $request_uri $request_key {
> default index;
> ~^/(?P<key>.+)$ $key;
> }

Yes, numeric references are not supported in map.

You can also change default to empty string:

map $request_uri $request_key {
default "";
~^/(?P<key>.+)$ $key;
}


--
Igor Sysoev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Best way to get the $request_uri without the starting slash

Matthew Ward December 19, 2011 04:56AM

Re: Best way to get the $request_uri without the starting slash

Valentin V. Bartenev December 19, 2011 06:08AM

Re: Best way to get the $request_uri without the starting slash

WheresWardy December 20, 2011 04:36AM

Re: Best way to get the $request_uri without the starting slash

Igor Sysoev December 20, 2011 04:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 131
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready