Welcome! Log In Create A New Profile

Advanced

rewrite rule to 2 subdirectory from filename?

Elena Zwetkow
July 18, 2012 07:08PM
Hello,

a short question about nginx rewrite function. Is it possible
to rewrite a url like:

http://domain.com/486ab6c88fd112a89ccgdwd04a3d8275:8d27ce:1.jpg

to a path like:

/media/48/6a/486ab6c88fd112a89cc4d9d04a3d8275:8d27ce:1.jpg

i will use the first 4 characters of my filename as 2 subdirectories. This was my test, but works not ...

location / {
rewrite "^/([a-z0-9] {2})([a-z0-9] {2})([a-z0-9]+)$" /media/$1/$2/$1$2$3
}

Is there a way i can debug such rewrite rules?

Thanks so much.

Elena


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

rewrite rule to 2 subdirectory from filename?

Elena Zwetkow July 18, 2012 07:08PM

Re: rewrite rule to 2 subdirectory from filename?

Valentin V. Bartenev July 18, 2012 08:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready