Forum Moderators: phranque

Message Too Old, No Replies

Mapping missing images to an unknown image of the same size

         

alantyss

1:15 pm on Apr 1, 2008 (gmt 0)

10+ Year Member




I have the following piece of code

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^image/[^/]+/[^_]+_([0-9]+x[0-9]+)\.jpg$ http://example.com/images/unknown_$1.jpg [R=301,L]

The RewriteCond %{REQUEST_FILENAME} !-f is true for all images. I would like the code to find all images that are not found. By placing the above code it thinks that all images are not files even though they exist. Can someone help?

I was recommended to use
<Directory "/your-site-path/images">
ErrorDocument 404 /images/not-here.jpg
</Directory>

However, I have images of different sizes. So I would like to map abc_74x74.jpg if not found to unknown_74x74.jpg and etc for the other sizes.

Thanks