URI pattern baffling problem

Splitice mat999 at gmail.com
Mon Feb 7 18:05:13 MSK 2011

Firstly you are missing slashes after each var/regex

Sent from my iPod

On 08/02/2011, at 1:43 AM, Gregory <ga at w00tw00t.ch> wrote:

> 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 at nginx.org
> http://nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110208/8319cdf4/attachment.html>

More information about the nginx mailing list