rewrite rule to 2 subdirectory from filename?

Elena Zwetkow ezwetkow at
Wed Jul 18 23:06:51 UTC 2012


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

to a path like:


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.


More information about the nginx mailing list