Welcome! Log In Create A New Profile

Advanced

URI pattern baffling problem

Gregory
February 07, 2011 09:48AM
Hi,

I am trying to work out a regular expression. What I am looking for is to
redirect any request that does not match a specific URI pattern.

The exact pattern is “documents/{VAR1}/pages/{VAR2}/items/{VAR3}” where
{VAR1} /{VAR2} /{VAR3} is a random chain of 36 characters made of A-Z, a-z,
0-9 and – (hyphen). Text is not case sensitive and the position of hyphens
is fixed. Would be great if I could also work trailing double-slash.

So far what I have generated is:

if ($request_uri !~*
"^documents/([a-z0-9\-]{36})pages/([a-z0-9\-]{36})items/([a-z0-9\-]{36})$" )
{
rewrite ^ http://www.google.com/ permanent;
}

Regular expression is not really my cup of tea, so any hint is most welcome!

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

URI pattern baffling problem

Gregory February 07, 2011 09:48AM

Re: URI pattern baffling problem

vt February 07, 2011 09:54AM

Re: URI pattern baffling problem

Splitice February 07, 2011 10:10AM

Re: URI pattern baffling problem

Gregory Agerba February 07, 2011 10:14AM

Re: URI pattern baffling problem

vt February 08, 2011 03:58AM

Re: URI pattern baffling problem

Gregory Agerba February 08, 2011 04:44AM

Re: URI pattern baffling problem

António P. P. Almeida February 08, 2011 05:06AM

Re: URI pattern baffling problem

Gregory Agerba February 08, 2011 05:58AM

Re: URI pattern baffling problem

Igor Sysoev February 08, 2011 08:14AM

Re: URI pattern baffling problem

Gregory Agerba February 08, 2011 08:22AM

Re: URI pattern baffling problem

Igor Sysoev February 08, 2011 09:04AM

Re: URI pattern baffling problem

Gregory Agerba February 08, 2011 09:12AM

Re: URI pattern baffling problem

António P. P. Almeida February 08, 2011 08:32AM

Re: URI pattern baffling problem

Igor Sysoev February 08, 2011 09:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 240
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready