Welcome to My Blogatory!

Monthly Archives: July 2015

I knew there was something wrong. Suddenly, there were tens of visitors coming to Adventures in Play each day! I just knew I wasn’t that popular. Using Google Analytics, I dug a little deeper to learn more about my sudden jump in popularity.

If you do not have Google Analytics set up on your WordPress site, I highly recommend investing the time to install it. It’s a statisticians dream, but more than that, it is a great way to drill down into your blog posts to learn where traffic is coming from and which posts are most popular.

There are a multitude of guides on how to get started. I found this particular article to be good. It offers a step-by-step guide for WordPress users:

Referrer spam is a bad thing because it represents false traffic and it messes with your Google Analytics. I’m interested in the 5 real visitors, not the hundred or so mindless bot hits.

Besides, there is an easy fix to keep these sites out. All you need to do is modify your .htaccess in the root of your WordPress website. There are several ways to go about this, but I found using the cPanel dashboard to be one of the most direct.

How to Block Span Referrers

Go to your cPanel management website and locate the Files section. This is not possible if your WordPress is hosted at WordPress.com. The steps below only apply to WordPress.org websites.

Within Files click on File Manager

A File Manager Directory Selection window will appear.
From the Document Root for: choose your website from the dropdown box, then click Go

Before we modify the .htaccess file, let’s make a backup. That way, if you mess it up, your website won’t be hosed.

From the File Manager, click on Copy.

Next, a Copy window will appear.
Enter the destination of the backup file. I choose the name “bak.htaccess“.
Click Copy File(s) button to save a backup.

Now you are ready to edit the .htaccess file directly.
Select .htaccess and then click Code Editor

A Code Editor window may appear prompting for the character encoding type.
For now, click edit (UTF-8 is fine for me).

Now for the fun part. Insert the site referrer banning rules just before the WordPress <IfModule mod_rewrite.c> section: