Replace invalid image url with 404 image

<FilesMatch ".(jpg|png|gif)$">
ErrorDocument 404 "/path/to/image.jpg"
</FilesMatch>

Here's one potential answer:

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.(gif|jpe?g|png|bmp) /path/to/logo.gif [NC,L]

Another is to use a custom scripted page:

Use the errorDocument directive (documented at [httpd.apache.org ]) to point a '404' error to a script (perl, PHP, whatever). If the requested file has an image extension (or has an image/* mimetype; PHP supplies the mime_content_type [us2.php.net] function for this; I'm sure there are many ways to do this in perl; the MIME::Types [search.cpan.org] module is one way), then set the "Content-Type" header to the mimetype of your logo image and return the content of the logoimage to the browser.

http://www.webmasterworld.com/forum92/3458.htm