php - How to rewrite timthumb image on nginx? -
i have original image below:
site.com/content/year/month/imagename.jpg i use timthumb generate thumbnail, new link below:
site.com/content/timthumb.php?src=site.com/content/year/month/imagename.jpg&w=a&h=b&zc=1 i want rewrite timthumb image url to:
site.com/img/year/month/imagename.jpg please me , thank much!
-- have try many way, not work. below some:
location / { rewrite ^/img/([0-9]+)/([0-9]+)/(.*).(jpg|jpeg|png|gif) /content/timthumb.php?src=site.com/content/$1/$2/$3.$4&h=150&w=150&zc=1 break; } location / { rewrite ^/img/([0-9]+)/([0-9]+)/(.*).(jpg|jpeg|png|gif) /content/timthumb.php?src=site.com/content/$1/$2/$3.$4&h=150&w=150&zc=1 last; }
unfortunately, not have nginx, but, after research, work you:
location / { rewrite ^img/([0-9]+)/([0-9]+)/(.*)\.(jpg|jpeg|png|gif) content/timthumb.php?src=site.com/content/$1/$2/$3.$4&h=150&w=150&zc=1 last; } i've removed leading slashes (which 1 in apache too).
update: used this generator come this. please give try.
location /img { rewrite ^/img/([0-9]+)/([0-9]+)/(.*)\.(jpg|jpeg|png|gif) /content/timthumb.php?src=site.com/content/$1/$2/$3.$4&h=150&w=150&zc=1 break; }
Comments
Post a Comment