blog-comment-spam

Reduce Spam in WordPress with .htaccess

Here’s a very useful snippet from allguru.net that helps reduce spam in WordPress. Blocking spam at the .htaccess level is more efficient and effective than merely using plugins, and you may want to try this out.

It’ll help if make a backup copy of your .htaccess file first. Once you’re done, simply paste this code into your .htaccess file located in the root directory of your WordPress install.

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_METHOD} POST

RewriteCond %{REQUEST_URI} .wp-comments-post\.php*

RewriteCond %{HTTP_REFERER} !.*yourdomainname.* [OR]

RewriteCond %{HTTP_USER_AGENT} ^$

RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

</IfModule>

 

Don’t forget to replace yourdomainname with your real domain name. This code will prevent spam bots from accessing your wp-comments-posts.php file directly and significantly help reduce the amount of spam on your blog.

 

Incoming search terms for the article:

Related Posts

Create a Slideshow With HTML5

1

Incredible CSS Transitioning ShareBar

How to add a Facebook “Like” button to your WordPress Blogs

10 Code Signing Providers

3 Comments

  1. Jakarta Rent Car

    02.02.2012

    I use anti-spam plugin, if it could be applied simultaneously?

    • Keith

      02.02.2012

      Yes, you can. But depending on what plugin you’re using, the overall protection could either be redundant or more efficient. Make sure that the plugin you’ll use can supplement the code effectively.

      • Jakarta Rent Car

        02.16.2012

        Ok than, i’ll see the code n try ur suggestion, thanks keith.. nice sharing :)