OVH Community, your new community space.

Help me with lighty, rewrite and Regex :)


Dave
02-03-2009, 16:51
Fixed!!!!!

"^/images/([a-z])([0-9])([0-9])([0-9])([0-9])/(.*)$"

Dave
02-03-2009, 16:27
I'm really stuck with trying to get my lighttpd setup how I want, I'm storing images one of my sites in a fairly complex directory structure which makes sense but I can't get lighttpd to translate it how I want.

I'm guessing only a good knowledge of regex is all that's needed to help me (clearly I don't have that), my url will look like this:

Code:
myurl.com/images/a0309/test.jpg
I need to use lighttpd to turn this into the following using regular expressions:

Code:
/my/dir/03_09/a/test.jpg
but I'm struggling to get regular expressions to do this, I've tried the following which I'm sure should work:

Code:
url.rewrite-once = (
        "^/images/[a-z][0-9][0-9][0-9][0-9]/(.*)$" => "/my/dir/$2$3_$4$5/$1/$6"
)
but it doesn't and i'm stuck , if any regex gurus could help it would be appreciated.

Thanks in advanced.