What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
How to Block Referrer Spam in WordPress Website Using Plugin

How to Block Referrer Spam in WordPress Website Using Plugin

Referrer spam is a common issue that can mess up website’s Google Analytics reports. Since millions of WordPress websites suffer referrer spam, we make this guide to deal with it effectively. In the beginning, a brief introduction of referrer spam makes it clear on what exactly the referrer spam is and the downsides it brings to your site. And then, we make a step-by-step guide on how to blog referrer spam in WordPress using a plugin.

What Is Referrer Spam?

What Is Referrer SpamReferrer spam, also known as referrer bombing or log spam, is a sharp practice to get a large number of backlinks. The spammers send a fake referrer URL with numerous requests to the target websites. If those site owners click the fake referrer URL, they have been caught into the trap.

The access logs including referrer statistics would be published unwittingly. In this way, the spammer sites can get free backlinks from the target websites and then rank on the front pages of search engines easily. That makes no difference to the affected website but get the site’s analytics report in great confusion.

Block Referrer Spam Using WordPress Plugin

WordPress has developed multiple plugins for blocking referrer spam, among which the SpamReferrerBlock and Block Referral Spam are selected in this guide. Both plugins are designed for preventing referrer spam in an easy manner.

Method 1: Use SpamReferrerBlock Plugin

SpamReferrerBlock plugin blocks referrer spam by filtering all incoming traffic. The spammers are recorded in a blacklist, which can never send fake referrer URL to your website. In this way, the referrer spam is killed in the cradle. Here, we are going to install and activate this powerful plugin through our website dashboard.

Install SpamReferrerBlock Plugin

A new item “Spam Referrer Block” is shown under Settings once you have the plugin installed successfully. Go to Settings > Spam Referrer Block and access to the Spam Referrer Block setting page. First of all, customize the general options.

The three options allow you to make a decision on whether to only check the first request. Also, that makes it possible to decide whether to keep blacklist up-to-date and how often to send local blacklist. And then, select a message that will be shown to the spammers or redirect the spammers to a custom page. Click “Save” button to confirm all changes.

Spam Referrer Block Setting Page

A custom blacklist is where to add the spammers you have known before. Add one spam website per line and then save the blacklist. That allows you to add as many domains as needed and modify the blacklist in anytime.

Custom Blacklist

By default, there are multiple domains included in the “Blacklist”, which have been blocked from users’ websites. The blacklist will be updated automatically and that can also be downloaded from server to your computer. By the way, the domains that are added to the custom blacklist are included in the blacklist.

Referrer Spam Blacklist

In this case, all fake referral URLs cannot be sent to your website and the recorded spammers can no longer send referrer spam to you.

Method 2: Use Block Referral Spam Plugin

This method is great for users who wish to achieve the same goal with little effort. The Block Referral Spam plugin enables an extremely easy way for preventing referrer spam from WordPress websites. There is no need to change any settings of the plugin. You are only required to have this plugin installed on your website and that works automatically. Install and activate this plugin via WP admin.

Install Block Referral Spam

Once detecting any new spammers, you are encouraged to inform the new spam domains to Block Referral Spam developers. So far, this plugin can protect your site from over 350 spam domains that are contributed by other users. The number of disclosed spam domains will increase continuously.

Method 3 – Filtering Function of Google Analytics

This method does not block the spammers from sending referral spam to your site, but can filter the fake traffic data out of your referral statistics in Google Analytics, resulting in a clean and accurate picture of your website traffic.

For this, you need to click the Admin button after entering your Google Analytics account and then hit the All Filters button. Here, you can add a new filter with the custom filter type, and enter the fake referrer domains into the space of Filter Pattern.

Add Google Analytics Filter

After clicking the save button for the new filter, you need to wait for about 24 hours and to check the new report of your website referrers.

Method 4 – .htaccess

The modification of .htaccess code is the simplest way for the blocking of referrer spam. You only need to add the following lines of codes into your htaccess file, then, the referrer spammers will receive the 403 Error page when sending a request to your server.

Block Referrer Spam with Code

Note that the above-mentioned codes only block three referrers. You can also check the report of your Google Analytics, figure out the referrer spammers, and add the custom referrers for blocking.


Lucy has been a very experienced SEOer, technical writer, web developer, c# developer since 2002. Now she owns a startup in San Francisco, CA, focusing on running a couple of blogs to share knowledge and experience with global readers and deliver exceptional results to global sponsors by leveraging the power of Internet.