How can i rewrite this?

i want to rewrite:

http://a.com/abcde.jpg
to
http://a.com/ab/cde.jpg

here is my nginx config:
rewrite “^/([a-z]{2})([a-z]{3}).jpg$” /$1/$2.jpg last;

but it not works

Posted at Nginx Forum:

Hi,

Avoid rewrite’s:

location ~ ^/([a-z][a-z])([a-z][a-z][a-z]).jpg$ {
try_files /$1/$2.jpg $uri;
}

Andrejs

Posted at Nginx Forum: