Spam Blocker, Stop Spam, htaccess, ip blocker, website

(251) 422-6044

Use htaccess to stop spam forever

Spam Blocker Use htaccess to stop spam forever

Form spam has to be one of the most annoying parts of running a website or blog. It seems like every day I am getting more and more spammers filling out my online forms or commenting on a post with some sort of crazy stuff that is at best annoying and sometimes just down right offensive.

So how does one stop it? Yes, using Captcha is a good way to start but for the most part it just irritates your legitimate visitors, especially if it is really good captcha and most people get it wrong the first time. Plus it is actually the equivalent of living in a bad neighborhood without locks on your doors and just saying "whose there" when someone knocks on your door.

Thank goodness there is a much better way. A way to put locks on your doors and have a security system. This way is using a small file on your server called .htaccess. It is a powerful little file that can control many things on your server but for now we are just going to cover how to stop spammers from even getting your forms and comment boxes.

There is a directive called a 303 redirect. What I like to do is use a known list of spammers and then redirect them to another site. My favorite is www.fbi.gov. Talk about giving an annoying spammer a bad day! If every time they try to access your site they are put into the spotlight of the FBI.

This is just like haveing not only locks on your doors but two police officers standing there ready to take the name and details of anyone who looks suspicious.

Sound good? Ok here is how you do it.

If you don't know about .htaccess files the first thing you want to do is see it there is already one on your root directory on your website. If there is you will need to download it so you don't overwrite anything important that is already there. If not just open a plain text editor and copy the text below into it, save it as .htaccess and load it to your server.

RewriteCond %{REMOTE_ADDR} 37.115.191.164 [OR]
RewriteCond %{REMOTE_ADDR} 178.73.197.191 [OR]
RewriteCond %{REMOTE_ADDR} 46.119.120.145
RewriteRule ^(.*)$ http://www.fbi.gov [R,L]

As you get more spammers you can add there ip address in a new line in the file and boom they get sent to the FBI

If you have any questions or comments contact us. We are here to help


Articles and Tools



Does Your Business Rank?

Get a free and instant scan across over 50 social networks and see where your business is listed.