At the moment we are using a .htaccess rule for user avatars, if they have not uploaded an avatar then a 404 occurs and shows a default avatar image.
However this happens thousands of times a day and the error_log is pretty much constantly being written to.
The .htaccess rule is in the /avatar/ directory which only consists of the image files.
PHP image code
<img src="/avatar/<?=$userId?>.png" />
.htaccess code used in the images directory
ErrorDocument 404 /unknown.gif
Is there any other fast way I could do this to stop the 404 error occuring or mabye even being logged?
Would a php.ini file in the /avatar/ directory that turned off error reporting work?
Simple. Only display the image, if the image exists.