Block Referer SpamBlock spam referers in htaccess files is the best place to keep these unwanted visits to your website. Referrer Spam mostly attacks Google Analytics by hitting random tracking-ID’s. If you want to get the best out of this powerful tool and have reliable statistics is important to keep your data clean by stopping this unwanted visits. In addition to messing up your data they can overwhelm your site and slow it down.

There are 2 different types of Spam Referers: Ghost Spam Referers and Crawler Spam Referers. Ghost Spam Referers uses your Google Analytics to make fake visits to your site. This type of spam targets random Google Analytics tracking ID’s with the only purpose of getting traffic from people that get curious about the referral in their analytics. This spam can only be blocked in your Google Analytics – not your htaccess file. A Crawler Spam Referer is an Internet bot that browses your site, typically for the purpose of Web indexing. This crawler usually ignores all rules like robots.txt which it suppose to stop the spiders from “crawling” specific pages. Here you should block spam referers in htaccess files.

Block Spam Referers in htaccess

Htaccess files are hidden plain text files that are on the server to help control how your visitors interact with your website. You’ll find it in the root directory of your site. It is used to block specific traffic from being able to view your website and give other instructions, like caching to your site. To access it in cPanel using file manager – make sure you have view hidden files turned on.

block spam referers in htaccess

Editing in your htaccess file is not difficult, but it’s always a good idea to make a copy of it before you start. Simply download it from you cPanel and save it until you know your changes work. If you are not confident writing code you can use a tool like IncrediBILL’s HTACCESS TOOLS to write the code for you. Simply copy the Spam Referers URL’s from your Google Analytics under Acquisition/Referrals that are affecting your site and paste them into the upper box and click the generate htaccess code button. It will generate the code you need to copy and paste into your htaccess file. Hit save and your all set! If you would like a list of Spam referers you can go to

It’s most effective to block spam referers in htaccess. You can filter them out in your Google Analytics but they will still be hitting your site – you just won’t see them.

WordPress Maintenance Plan Add