Forum Moderators: phranque

Message Too Old, No Replies

Forbid Access AND not log Referer?

Stopping access log spam!

         

JAB Creations

2:06 am on May 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Casino nerds are spamming my access logs with referers looking for free links back via public statistic scripts.

I'd not only like to 403 these IP addresses but also keep Apache from accepting the referer (so as to not record it to the access logs and thus make it's way to the statistics script).

I can ban the IPs but the referers still make it through.

- John

*EDIT*

I think this does that but I'm not sure if the referers are still logged? Blocking referers with stings of "123", "456", and "789" in this example...

# Block spam referers trying to get listed in public logs.
<Files /error/error-403.php>
order deny,allow
deny from all
</Files>
RewriteCond %{HTTP_REFERER} (123¦456¦789) [NC]

- John

jdMorgan

12:50 pm on May 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to set a variable based on Referer using mod_setenvif or mod_rewrite, and then configure mod_log_config [httpd.apache.org] to check that variable to determine whether to log the request.

I believe ther are some older threads around here on the subject -- search for "mod_log_config" or "CustomLog".

Jim