I got the referer spam lately. It’s not much each bandwidth, but kind of annoy. The website owner that usually got referer spam is the blog site or website that show top referer or shout box or something.
The definition of referer spam : http://en.wikipedia.org/wiki/Referer_spam
Here is the way to prevent!
Log into your site’s FTP server. Make sure it is set to display hidden files on the server. Check your FTP client’s documentation for help with that. If there is a file named .htaccess, download it and open it in a text editor. If there isn’t one, create one on your hard drive and upload it when you are finished.
Put this in the .htaccess file, changing “spammersite” to the name of sites found spamming your logs. The first site listed should not have “NC”, and the last one should not have “OR”.
If your site starts generating errors after you upload this file, remove the # from the first line. If you use Microsoft Frontpage on your site, do not do this. Changing the .htaccess file could interfere with Frontpage.
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite1.com.*$ [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite2.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite3.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite4.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite5.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite6.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?spammersite7.com.*$ [NC]
RewriteRule .*$ http://www.some-other-website.com [R,L]
This will redirect any request with a spammer site in the refer to any other site you wish. If you prefer, you can rewrite that last line as “RewriteRule .* - [F,L]” to give them a “Forbidden” error. Either way, it keeps them out of your referer logs and there is no way to defeat it.
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.