How to stop bad bots from visiting your website


Recently I noticed in Google Analytics a lot of referral to the page that doesn’t exist on one of my website. Visiting the page gives a 404 error. Diving deeper into Google Analytics learned me it was all referral spam from a website called

After searching on the Internet I found out it definitely was referral spam. Because it visits a non-existing page, but still gets counted by Google, I wanted it gone! Luckily several specialists offered a very nice solution, that works like a charme.

Add this code to the .htaccess file of your website and this kind of automated referral spam will not get on your website anymore.

 RewriteCond %{HTTP_REFERER} [NC,OR]
 RewriteCond %{HTTP_REFERER} [NC,OR]
 RewriteCond %{HTTP_REFERER} [NC,OR]
 RewriteCond %{HTTP_REFERER} [NC]
 RewriteRule .* – [F]

You can add as many lines as you need to stop those referrers spam your website. Make sure the last line ends with [NC].

Always backup your .htaccess before changing it!


Please enter your comment!
Please enter your name here