Forum Moderators: phranque
You can send a redirect response to blocked referrers, but most of them won't bother to follow a redirect (It is up to the client to decide to follow a redirect or not).
Perhaps what you are asking is if you can get rid of these entries in your log files. In that case, the answer is yes if you have server config privileges and no otherwise. If you have httpd.conf access, you can set up custom logging (see Apache mod_log_config), and just drop those 403 log entries.
If you have no admin privileges, then the best you can do is reduce the bandwidth wasted on these requests by sending a very short 403-Forbidden response. You can do this as follows:
In this way, any unwelcome request is rewritten to the subdirectory, but all files except the 403 error page in that subdirectory are forbidden, so the error handler is invoked, and serves the very-short 403 error page.
I hope that helps.
Jim
Basically, the only way to avoid logging is to use mod_log_config in httpd.conf, or to block the request at the firewall by IP address, before it even reaches your server.
I suppose you could also write a script to remove these entries from your raw logs, or modify your 'stats' script to ignore them. Depends on what the end-goal is.
Jim
For the re-direct issue, it can be done but where to re-direct it to? Redirect the hits to someone legit like Google, and that's really uncool... There is a way to bounce the hits back to the spammer, but I did this once and next thing I knew, they took revenge on me and I am not sure how it was done but the entire .htaccess procedure was bypassed and I really had my hands full emptying my access log daily, line by line. In the meantime, I lost the command-line but I speak from experience when I say the best thing to do is simply absorb the hits.
In the end I also disabled the 'origin' part of my public statistics, while it leaves my stats page minus one function, it also gives me peace and quiet as I no longer have to worry about this issue. I am sorry, but it appears to be the only permanent solution to the headache.
Peace out.
So I just blocked all of the empty referrers like this:
SetEnvIf Referer ^$ empty_referer
Deny from env=3Dempty_referer
Hopefully, that will take care of that pain Norton (NIS) and Agnitum/Outpost
Then I blocked all that ++++++++++ noise like:
# An empty string or a dash is not a valid UA string.
RewriteCond %{HTTP_USER_AGENT} ^-?$
RewriteRule!\.403\.php$ - [F]
# ------------------------------------------------------------------------------
# A user-agent (or a referer) which string is :
# XXXX:+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# and another which is a series of dashes
RewriteCond %{HTTP_USER_AGENT} ^xx+:\++$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^--+$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^xx+:\++$ [NC]
RewriteRule!\.403\.php$ - [F]
I have to do this, the amount of spam lately is crazy. I consider all those who come to my site as blocked referrers either are spam, or have something to hide.