Block Spam Referrers on Your Website or Blog

Last month, suffered a lot due to heavy fake traffic generated via some unwanted websites. Those websites were not referring TechSansar but using scripts to alias the visitors or send fake visitors to the site. As much as thousands of fake visitors consumed more than 2 gigs of bandwidth each hour. And finally we had to take actions, now we have no such fake referrers, or such referrer spams reduced to just few number.No spam logo, img credit
So, on this article we write about different ways to understand the fake referrers and to totally eliminate them. Now onward do not become happy if your blog have majority of visitors from some Polish or Russian matured content sites, yes they are fake and they don’t produce any page impressions or page views at all.
What is a Referrer Spam?
Referrer Spam or log spam or referrer bombing are all spamdexing ie spamming or referring fake visitors according to Wikipedia. With increasing spam referrers, your bandwidth is consumed and you have bad impression with search engines; while those spam websites get benefit from search engine after establishing link connection with your website. There are lot of harms to your server and site performance, in the meanwhile we don’t want it at all. They are not genuine HTTP referrer at all, avoid them.

How to Block Referrer Spam?

There are a number of ways to block fake HTTP or Referrer Spams, whatever the process mean they basically do the same task of blocking unwanted visitors to your website or blog.

Increasing SPAM referrers... and controlling them: read full article @
Increasing SPAM referrers... and controlling them: read full article @

Block referrer using .htaccess file

Open .htaccess file on your web server where your website is hosted (in most of the cases it is hidden, ensure that the file is *.htaccess extension only with no name) and append the chunk of codes to the file.
Visit and copy paste the given codes to your .htaccess file (ensure you do this only to the code said to you, do not copy paste the whole html document) and you can modify the code to meet your requirement.
block user agents used to harvest URLs and email addresses
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.0 .*Win 9x 4.90.*$ [NC,OR]
block bots that use your bandwidth for their own commercial reasons
RewriteCond %{HTTP_USER_AGENT} ^.*TurnitinBot.*$ [NC,OR]
block URLs based of certain keywords

RewriteCond %{HTTP_REFERER} ^(http://)?(www.)?.*(-|.)affiliate_program(-|.).*$ [NC,OR]
block traffic directly from selected IPs
deny from
Block referrers using variables of server
This may not be easy task for most of the readers, so be careful when using it. For details see this article at, set span_ref environment variable like

SetEnvIfNoCase Referer "^http://(www.)?" spam_ref=1

or in allow deny portion insert

Deny from env=spam_ref

Block referrers using WordPress hacks
If you are using WordPress to host your website or blog, then there are several plugins or you can even apply WP hacks to prevent unwanted websites to refer to your website. Using following WordPress plugins will easy your work a lot, eg keywords and urls to block from your list.
WordPress Top Referrers: The WordPress Referrers plugin is a fully automated, self running referral tracking script.
You set it up once and just let it run, the list is automatically cut after x days, you can block any domains from being included, includes spam protection and other features.
Secure WordPress by SSM: Remove Error information on login page; adds index.html to plugin directory; removes the wp-version, except in admin area.
Also be careful with Do follow and Do not follow traits.
That’s it with the spam guard. Now you should have some clean referrers, huh. Confused still, write to us.

You might also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More