Forum Moderators: phranque
Not sure whether this is a ErrorDocument issue or a mod_rewrite issue, so I can't tell what to search for.
I have a directory with 18,000+ mugshots. One of my content pages shows some of these mugshots, but the html data is pulled via AJAX. Since one page could have well more than 100 records, I'm reluctant to do a server side check for each file before sending the XML data.
What I'd like to do is set an .htaccess line to send a "no_mugshot.jpg" if the requested mugshot isn't located.
I tried doing
ErrorDocument 404 /dev/mugs/no_mugshot.jpg
but that doesn't work.
Am I on the right path?
One problem is that ErrorDocument means what it says -- document. And an image is not a document, so that may not work on first principles. But I haven't tested it.
There are several ways to do this. One is to use mod_rewrite's RewriteCond directive to check to see if the requested image exists, but that may have a performance impact, as you fear.
Jim