I have a script that generates images having such urls: /photo/XXXX/W/H where XXXX an id of image, w - width and h - height
there is no directories called photo/XXXX on webserver document root. Now I created directory /cphoto and script caches images to that folder. Once script launches it generates static image in folder /cphoto with name XXXX_W_H.jpg
I need to write rewritecond instruction capable to rewrite web queries from script's url to static urls such as /cphoto/xxxx_w_h.jpg if that file exists.
RewriteCond ????
RewriteRule ^photo/(.+)/(.+)/(.+)$ /cphoto/$1_$2_$3.jpg