Removing Referral Spam From Your .htaccess File

When we dig into our client's analytics reports, we often take a look at referral traffic. While our main focus is organic traffic, it's important to keep an eye on what sources are sending traffic to your clients, since these "backlinks" can actually play a pretty significant role in SEO.

Google loves to see high quality websites linking back to your site. However, when we start to see "mysterious" looking links referring traffic, a red flag immediately gets raised because we know these are often spammers, which mass target websites out of the blue. When Google looks at who's linking to a website, and who it's linking to, it doesn't want to see spammy looking links, but instead Google wants to see links that are relevant to that industry, thus supporting what the website is trying to tell Google in the first place. 

If you come across any of these spammy referral sources in your analytics, they will need to be removed as soon as possible. Not only are spammy backlinks bad for SEO, but they also falsley inflate analytics data, making a website appear to be performing better than it actually is. Overall traffic is inflated, and when traffic is inflated, metrics like bounce rate, time on site, etc. are also skewed. It's our job to make sure our clients' analytics data stays as accurate as possible. Plus, handing a client a report with mysterious traffic sources can be very confusing for them, and look unprofessional. While it is impossible to block all of the spammy referrals, it is still good practice to keep an eye out, and do your best to eliminate them as best you can.

Over the past few weeks, we've cracked down on these spammers, and looked into some of the more common referrals we tend to come across most in analytics. These spammers are not just from across the country, but also across the world. Here at Pixel we are dedicated to staying on top of the latest "trends", and currently that means we're sharing a list of the most common spammers we find, and how to get rid of them using the .htaccess file. 

Common Referral Spam Sources

How to Remove Referral Spam Using the .htaccess File

While you could go the route of setting up a filter in analytics, it is much easier to just block the domains completely using the .htaccess file and prevent the spam from coming to your server in the first place. The .htaccess file is very important, and even a single misplaced character or one wrong asterisk could take your client's site down indefintely. Basically, the .htaccess file helps to dictate how your server behaves. Needless to say, this file should not be altered unless you are a professional. And always, always, make a backup of the file before you make any edits to it.

To prevent the common case of referral spam, simply copy and past this code into the .htaccess file.

# Block Referrer Spam
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://.*semalt\.com/ [NC,OR]
RewriteRule ^(.*)$ – [F,L]

For each domain you want to block, plug it in here... ^http://.*DOMAIN-NAME-HERE\.com/

We should also mention that we are speaking from the view point of using Joomla, and .htaccess files in Wordpress, and other CMS platforms will look differently, and might accept a slightly different variation in code.

This is just a small list of common referral spam, as there are hundreds and thousands of spam bots raiding the internet. As we come across more, we will be sure to share them with you.

Contact Us

Interested in a free consultation? Fill out our Get Started form…

Go for it!

Or, give us a call...

Drop in and say hi...
401 W. Capitol Ave. STE. 400
Little Rock, AR 72201


Pixel Perfect Creative | 501.537.2246 | info@pixelperfectcreative.com