Codeable info

Reduce Comment Spam By Protecting Your WP-Comments-Post.php File

Posted on by in WordPress Tutorials

I came across a useful tip by AllGuru from a year ago that I thought I would share with you all. In the article they showed several solutions that you can implement through .htaccess to protect make your website more secure.

The one that grabbed my attention reduces comment spam by protecting your wp-comments-post.php file from spam bots. The wp-comments-post.php is the file that spam software accesses in order to leave comments on your blog. If you are sick of getting pointless irrelevant comments from spammers, add the following code to your .htaccess file, making sure that you change to your website domain.

<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]

If you are unsure about any aspect of this, please let me know.


Comments Closed

Codeable info