0
votes

[Sat Nov 19 13:17:04 2011] [error] [client 1.1.1.32] File does not exist: /var/www/vhosts/x.com/httpdocs/scores.asp

[Sat Nov 19 13:17:54 2011] [error] [client 1.1.1.32] File does not exist: /var/www/vhosts/x.com/httpdocs/reqewrqwe.awwe

Solved thanks

1
Also take a look at serverfault.com/questions/36589/…rid

1 Answers

5
votes

Create a RewriteRule and return an empty file in response to the URLs you'd like to remove from the logs:

RewriteRule scores\.asp$ - [L]

In case you don't have any pattern for the URLs and you want to prevent for all non-existing files, add a RewriteCond:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [L]

Or just with a more current apache:

FallbackResource /index.php

and then index.php giving a 404 status response:

<?php
header("Status: 404 Not Found", 1, 404);

The index.php file must exists, otherwise (for the RewriteRule) this would create an endless loop.

Alternatively this might work (and won't require the index.php file):

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ - [R=404,L]

See: Apache2: how to avoid logging certain missing files into error.log