On Mon, May 02, 2011 at 07:54:57PM +0200, Yanxin Z. wrote: > Hello, > I need to rewrite the URL > > /img/14567.jpg to /img/14/14567.jpg > > The image name is 14567.jpg, which is saved in /14 folder. /14 is > caluculated by 14567 / 1000 > > How to implement is NGX rewrite? location /img/ { location ~ ^/img/(..)(.+)$ { alias /path/to/img/$1/$1$2; } } -- Igor Sysoev