Block Referrer Spam

Block Referrer Spam at the Source

I’ve been working on other projects and it has been a while since I added new content to Crash Cloud. I was quite impressed as I blew the dust off my Google Analytics account to see if anyone was still visiting this site; traffic had tripled and I hadn’t lifted a single finger. Nice!

However, after peeling back the layers of the onion, a different reality reared its ugly little head… referrer spam!

If you are not familiar with the term, referrer spam (aka referrer bombing) is a blackhat traffic generation technique used by some of the shadiest companies to drive traffic to website sales pages. These webmaster uses bots to crawl thousands of websites and falsely impersonate a real visitor.

When webmasters view their website’s analytics and sees dozens of visits from a referrer in Russia, curiosity naturally drives them to visit the site and see what it is all about. They are then immediately redirected to another website which is usually promoting a product or service.

Spam referrals also make a mess of Google Analytics data because these referrals have high bounce rates – in my case the data was skewed so badly that I couldn’t make sense of anything. I knew it had to be stopped.

I won’t go too heavy into details as other sites like Raven’s blog have covered the topic of blocking referrer spam in much greater detail. After trying a few different techniques, I found the most effective way to block referrer spam is to update the .htaccess file and block these spammers cold in their tracks.

how to block referrer spam at the source

How to Block Referrer Spam with your .HTACCESS File

To block referrer spam, simply access the root folder of your website via the cPanel or an FTP program like FileZilla. Edit the “.htaccess” file and add the following code to the bottom:

RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC,OR] 
RewriteCond %{HTTP_REFERER} [NC] 
RewriteRule .* - [F] 

That’s it! As more spammy website referrers show up in your website logs and analytics, add another line and kiss the spam good-bye.

RewriteCond %{HTTP_REFERER} <strong><span style="color: #800000;"></span></strong> [NC,OR]

If this article helped you block spam referrals to your website, don’t forget to spread the word below. 

Similar Posts