My website used to be inundated with referrer spam until I wrote a php script to address the problem. Now, referrer spam isn’t a problem anymore.
What is referrer spam?
Referrer spam is when a person or bot fakes a link hit from another website to your website. So, when your logging script records the visit, it records the referring website address, which is also faked by the spammer. Typically, the referral URL address leads to pornographic websites or those selling pharmaceuticals. It’s a sneaky way for spammers to pass their website links to you.
I wrote a php script for my own website to combat referral spam. The script was such a success that I now only have a small fraction of the referral spam attempts that I used to have before I started using the script.
I decided to package the script for distribution.
You can download the script here: Download Version 1.0.1 Updated 10.01.10
This script is intended for php 5 or higher and comes without warranty or guarantees. Modify it as you like and redistribute it as you wish. I offer support, but only according to the terms on my Contact page. Error reports are always free!
How does it work?
The referrer spam checker begins by checking the referring URL address against a list of filters which are common to spam. Then, the script scans the referring webpage’s content for spam. If the referral fails any test, the user is optionally automatically banned and the infracting IP address is added to .htaccess for future denial. Finally, the script emails a log of the action to the administrator. Some features are optional.