MOD Rewrite Quickie

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Hi,

I have a thumbnail resize that sizes images on the fly. However, it generates a pretty awful url, which is annoying me:

Code:
www.mySite.com/thumbnail-sizer.php/[COLOR=Red]myProd.jpg[/COLOR]?width=230&image=/img/product/[COLOR=Red]myProd.jpg[/COLOR]&quality=60
I want a neater URL structure like:

Code:
www.mySite.com/images/product/large/myProd.jpg
I've tried using the below rule but I can't get this to work at all, I think it has something to do with the filename being included twice in the URL (highlighted). The image needs to be there twice as per the script I'm using (http://shiftingpixel.com/2008/03/03/smart-image-resizer/).

Code:
RewriteRule ^images/product/large([^/]*)$ thumbnail-sizer.php/$1?width=230&image=$1&quality=80 [L]

Any help appreciated.
 
Last edited:
This does what you want (I modified it slightly to match your original URL example)
Code:
RewriteRule ^images/product/large/(([^/]*))$ thumbnail-sizer.php/$1?width=230&image=/img/product/$2&quality=80
 
Back
Top Bottom