How to stop bad bots from visiting your website?

Recently I noticed in Google Analytics a lot of referral to the page https://www.worldofwp.com//h/1486338.html that doesn’t exist on 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 autoseoservice.org.

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} buttons-for-website.com [NC,OR]
RewriteCond %{HTTP_REFERER} auto-seo-service.org [NC,OR]
RewriteCond %{HTTP_REFERER} autoseoservice.org [NC,OR]
RewriteCond %{HTTP_REFERER} see-your-website-here.com [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!

Ronald Heijnes
Ronald Heijnes

Since 2008 I keep myself busy with the functionality, management, maintenance and performance of self hosted WordPress. I like to share this knowledge. All in my spare time!

Articles: 44

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *