Вопрос

I am having an issue where a number of images have been used by external sites and at present it is simply showing as images not being found. I would like to have these errors obviously in the logs, however I would also like to have Apache serve the requester with a 1x1 transparent pixel image instead of simply not finding it. How does one set this up?

Это было полезно?

Решение

As @CBroe already suggested, you can give any document as the ErrorDocument served to the client, even a transparent pixel image

ErrorDocument 404 /images/1x1.png

If you put the .htaccess in the images folder, only missing files from here and below will be treated.

The returned status code 404 will still be logged in the access.log together with the missing image filename.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top