Welcome! Log In Create A New Profile

Advanced

regex issue

January 19, 2012 02:08AM
For some reason, I am unable to take a URI like
example.com/manufacturers/metlox/0?page=13 and change it to
example.com/manufacturers/m

It seems like the curly braces aren't working. I've tried the following
without results:



location ~* /manufacturers/ {

rewrite "^/manufacturers/(.{1})/(.*)$" /manufacturer/directory/$1
redirect;

}

location ~* /manufacturers/ {

rewrite "^/manufacturers/([a-z] {1})/(.*)$"
/manufacturer/directory/$1 redirect;

}



location ~* /manufacturers/ {

rewrite "^/manufacturers/([a-z]?)/(.*)$" /manufacturer/directory/$1
redirect;

}



I am new to regex, so maybe this is something simple. What I want to get is
the first letter of first captured word. What I can do is pull the entire
word with (.*), but not the first letter only.

Any help would be appreciated.



Thanks in advance.



Using nginx 0.8.53 reverse proxy in front of apache



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

regex issue

mpratt January 19, 2012 02:08AM

Re: regex issue

Edho Arief January 19, 2012 02:18AM

Re: regex issue

Edho Arief January 19, 2012 02:20AM

Re: regex issue

mpratt January 19, 2012 08:35AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 204
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