Trick to Deny Comment Posting to No Referrer Requests

Simply one of the best trick to stop comment spam, In this short blogpost we’r going to look at is denying comment posting to no referrer requests – in other words, if the comment isn’t actually coming from your site, then it gets blocked. Make sure you change the url in line four to your blog.

Simply copy the code into .htaccess at the root of ur wordpress installation!!

 

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourblog.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

If you enjoyed this post, make sure you subscribe to my RSS feed!