When it comes to using wordpress as a blogging platform, you can agree with me that spam is one thing that would piss you off if not treated properly. I recently made a post on the Best Anti Spam Plugins which would help you defeat the war of spammers on your blog.

reduce spam using .htaccess in wordpress



Here is another approach to defeat spammers using the .htaccess file.



It would involve you editing your .htacess code as shown below, or simple copy this and paste. Remember to change yourdomain to your domain name.




<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomainname.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Note: It is recommended that you backup your .htaccess file before performing this casre. It can be reused if something goes wrong.

Hope this WordPress tip was helpful.


Please enter your comment!
Please enter your name here