Welcome! Log In Create A New Profile

Advanced

Re: nginx rewrite

May 02, 2011 02:58PM
On Mon, May 02, 2011 at 08:48:50PM +0200, Yanxin Z. wrote:
> Hello Igor Sysoev,
> Thank you for your help.
>
> You suggestion is great, but my problem is a little bit complicated.
>
> The image name is flexible, can be from 0.jpg to 23456.jpg, we organize
> the image files into folders, whose name is the number divide by 1000.
> For example, the folder 100 saves the file 100000.jpg to 100999.jpg.
>
> Both the folder and file name are flexible in my case.
>
> Do you have any suggestion on it?

location /img/ {

location ~ ^/img/(\d)(\.jpg)$ {
alias /path/to/img/0$1/$1$2;
}

location ~ ^/img/(\d\d)(\d*\.jpg)$ {
alias /path/to/img/$1/$1$2;
}

return 404;
}


--
Igor Sysoev

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

nginx rewrite

Yanxin Z. May 02, 2011 01:56PM

Re: nginx rewrite

Igor Sysoev May 02, 2011 02:12PM

Re: nginx rewrite

Yanxin Z. May 02, 2011 02:50PM

Re: nginx rewrite

Igor Sysoev May 02, 2011 02:58PM

Re: nginx rewrite

Maxim Dounin May 02, 2011 03:20PM

Re: nginx rewrite

Yanxin Z. May 02, 2011 03:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 126
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready