a question that is now partially resolved. A genius who can speak Apache fluently can shine light into this matter...
GIVEN: Most proxies, do not cache resources with a "?" in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for these resources, i have to remove query strings from references to static resources, and instead encode the parameters into the file names themselves.*
CURRENTLY HAVE
<img src="/imgcpu?src=folder1/photo_citty.jpg&w=3500&h=10&c=p&q=90" />
<img src="/imgcpu?src=folder2/photo_doggy.jpg&w=100&h=200&c=p" />
<img src="/imgcpu?src=folder3/photo_birds.jpg&w=200&h=500&f=bw" />
<img src="/imgcpu?src=folder3/photo_frogs.jpg&w=200&f=bw" />
WOULD LIKE
<img src="/IMG-folder1/photo_citty.jpg_w3500_h10_cp_q90" />
<img src="/IMG-folder2/photo_doggy.jpg_w100_h200_cp" />
<img src="/IMG-folder3/photo_birds.jpg_w200_h500_cs_fbw" />
<img src="/IMG-folder3/photo_frogs.jpg_w200_fbw" />
- The images will reside in 1 folder deep on the root (never deeper)
- the img.php?src= or img?src= will be consistently named this forever
I know the "img?src=" is a bad part and have already handled with that:
# Rewrite imgcpu?src= thumbnail maker to nice static urls
RewriteRule ^IMG-(.*) /imgcpu?src=$1 [L]
But the rest im stuck at. any and all clues are greatly welcome. Thanks.
PROGRESS
IMG-folder1/photo_citty.jpg&w=3500&h=10&c=p&q=90
WORKS
IMG-folder1/photo_citty.jpg_w-3500_h-10_c-p_q-90
DOESNT WORK
IMG-folder1/photo_citty_w-3500_h-10_c-p_q-90.jpg
DOESNT WORK
RewriteRule ^IMG-(.+)_w-(.+)_h-(.+)_c-(.+)$ imgcpu\?src=$1&w=$2&h=$3&c=$4 [L]
RewriteRule ^IMG-(.+)_w-(.+)_h-(.+)_f-(.+)$ imgcpu\?src=$1&w=$2&h=$3&f=$4 [L]
RewriteRule ^IMG-(.+)_w-(.+)_h-(.+)$ imgcpu\?src=$1&w=$2&h=$3 [L]
RewriteRule ^IMG-(.+)_w-(.+)$ imgcpu\?src=$1&w=$2 [L]
RewriteRule ^IMG-(.+)_h-(.+)$ imgcpu\?src=$1&h=$3 [L]
# pfff endless possibilities!!
And this doesnt even cover the cases where first the height is given the width. No this shall not work!
Lets find a solution to redirect all OPTIONAL &w= or &h= with something like &[a-z]=(.*) sothat _h- or _w- are universal and doesnt matter what letter is there _c- or _q- anything could then fit. THAT would be a very welcome rewrite.
Meanwhile this does works!!
<img src"/IMG-folder/photo_w100_h100_cf_q60.jpg"/>
by using:
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_c(.+)_q(.+).jpg$
imgcpu\?src=$1\.jpg&w=$2&h=$3&c=$4&q=$5 [L]
So the assignment Now is:
Rewrite any or all of the queries that follow [photo123.jpg]&[a-z]=(.*)&[a-z]=(.*)etcettera
into photo123_X-x_Y-y(optionally more queries).jpg