Combat SPAM with .htaccess and more

Modifying .htaccess to Prevent WordPress Spam Comments
.htaccess can help tighten wordpress security. Short lines of codes can really help to reduce spam comments. Add the code below to your root .htaccess to deny bots with no referrer.

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

Replace “” with your blog url. The code only blocks SPAM BOTS and not humans who manually try to spam. Bots are the most annoying pests so preventing them from spamming is a good first step. As for human spam, we have Akismet and Quiz to take care of that..

Useful anti-spam plugins

WP anti-spam and Quiz both work well.

Leave a Reply

Your email address will not be published.