Get Rid Of Spam Bots Without A Plugin

This blog gets around thirty spam comments a day. Not a huge nuisance, really, but it’s my beauty blog that drives me nuts. It literally gets around more than a thousand spam comments a day. And my blog stats do not even improve from that. It normally should. At the very least, my Alexa stats should be affected positively because for every spammer I get, that should be at least one page view. But you know, spammers never come in a normal package.

I don’t know exactly when the spam party started but yesterday I was finally fed up enough to look for a drastic solution. I discovered this neat .htaccess trick yesterday, and decided to try it. Lo and behold! When I checked my comments to the blog today, it has no spam. Zero, zilch, nada. Is that a glorious sight or what? What these lines of code do is deny access to no-referrer requests. Simply put, spam bots cannot infiltrate your blog anymore.

Spam bots are the type of spammers that I really hate. Not only can they make gazillions of spam comments in minutes, they also seem like they fell out of the sky straight into your blog. They come from nowhere, so naturally, your Alexa stats do not improve.

So, what did I do? It was reading through the WordPress codes the other day (yes, I do that), and I stumbled upon this nifty piece of code that you can put anywhere in your .htaccess file (which is found in the root of your WordPress installation):

[javascript]RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L][/javascript]

Be sure to replace yourdomain.com with your actual domain name (without the www). Use an FTP program to edit your .htaccess or straight from your cPanel, and make sure to show hidden files, because .htaccess is usually a hidden file. So there you go.

SHARE THIS article
Facebook
Pinterest
Twitter
Print
Email

GET UPDATES

Sign up to my newsletter so you get first peek into my detailed reviews, latest updates and occasional fun emails.

5 Responses

  1. i would love to try that, I hate seeing and deleting spam in my spam folder. ang dami nila, okay sana kung ung spam na na uuulam:D

Leave a Reply

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

STAY IN THE KNOW

Sign up to my newsletter so you get first peek into my new uploads, detailed reviews, latest updates and occasional fun emails.