URI pattern baffling problem

António P. P. Almeida appa at perusio.net
Tue Feb 8 12:58:03 MSK 2011


On 8 Fev 2011 09h41 WET, gregory.agerba at gmail.com wrote:

> [1 <multipart/alternative (7bit)>] [1.1 <text/plain; ISO-8859-1
> (7bit)>] Ok you are right, I did also copied it wrong, anyway, this
> one don't work any better anyway:
>
> if ($request_uri !~*
> "^documents/([A-Z0-9-]{36})/pages/([A-Z0-9-]{36})/items/([A-Z0-9-]{36})"
> ) { rewrite ^ http://www.google.com/ permanent; }
>
> Which does contain all slashes. The expression never match. I am
> trying with the following URL
> http://www.domain.tld/documents/C49775E0-4C80-0001-22B1-13B052801E5C/pages/C4977880-4C80-0001-22B1-13B052801E5C/items/C4977880-4C80-0001-22B1-13B052801E5C
>

Try: "^/documents/(?:[A-Z0-9-]{36})/pages/(?:[A-Z0-9-]{36})/items/(?:[A-Z0-9-]{36}"

It's working for me in cl-ppcre with the URI you gave as an example.

--- appa



More information about the nginx mailing list