WordPress tip for security, block spam bot wordpress sites using apache. I faced a lot of issue with spam comments in my blog. Spam-bot sites will just hit. Spam-bot sites will just hit the wp-comments-post.php file and put the comments. Due to this our lot of time get wasted.
block spam bot wordpress sites using apache
Using apache setting you can protect your blog and restrict the spam bot. You need to made changes in your Virtualhost entry or you can change the .htaccess file also.
When a spam-bot comes in, it hits the file directly and usually does not leave a referrer. This allows for some nifty detection and action direct from the server. If you are not familiar with Apache directives, then write the following in your root directory .htaccess file:
RewriteEngine On RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .wp-comments-post\.php* RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]
This will:
- Detect when a POST is being made
- Check to see if the post is on wp-comments-post.php
- Check if the referrer is in your domain or if no referrer
- Send the spam-bot BACK to its originating server’s IP address.
You just need to change the youdomain.com to your domain address.
This tutorial is written by purabtech.in. If you are having any issue then please write to me on support@purabtech.in
good to know about spam-bot concept.
Great! Everybody should use this to help Askimet working less…
Using JS to replace the action target could be good too.
thanks for reply