Forum Moderators: phranque
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?
Thanks!
In these cases, I suggest temporarily changing the code so you can see what is going on:
# Commented-out for testing
# RewriteCond %{REQUEST_FILENAME} !-f
#
# Prevent looping while doing this test
RewriteCond %{REQUEST_URI} !^images/unknown_
# Rewrite image requests to "/images/unknown_" and show REQUEST_FILENAME in address bar
RewriteRule ^image/[^/]+/[^_]+_([0-9]+x[0-9]+)\.jpg$ http://example.com/images/unknown_$1.jpg?req_filepath=%{REQUEST_FILENAME} [R=301,L]
At any rate, looking at the actual filepath that is being tested --along with the info in your server error log-- will tell you.
Jim