HOME       >>       Websites and Web Designing

Kill Spammers Before They Arrive .htaccess method


Recently, I encounted serious spammer attacking. They came like water fall, registering every minute, never stop. I had to install a humanity protection plugin. This plug in efficiently blocked the spammers. But the problem didn't end there-- the spammers kept trying to register. Every registering activity requires the register page from server, at the end, it cost me 3000mb bandwidth per month. A small site with limited resources like mine, this is a lot, and my site really got slower and slower. So, I searched around and found this little code to kill them permenently, before they comsume my bandwidth. Here's the code:

# BEGIN ANTISPAMBLOG REGISTRATIONRewriteEngine OnRewriteCond %{REQUEST_METHOD} POSTRewriteCond %{REQUEST_URI} .your-signup-page.php*RewriteCond %{HTTP_REFERER} !.your-domain. [OR]RewriteCond %{HTTP_USER_AGENT} ^$RewriteRule (.*) [url="http://forums.xisto.com/no_longer_exists/; [R=301,L]
Put this code in your .htaccess file.

Change "your-signup-page.php" to your signup page slug. For example, if your signup page is http://forums.xisto.com/no_longer_exists/, then, change it to "register.php". if your signup page is http://forums.xisto.com/no_longer_exists/, then, change it to "register"

Change "your-domain" to the domain of your blog.

Optionally, change "die-spammers.com" to whatever page you wish to send the spammers.


What does this code do?

It detect any POST requests (submitting a form) for your signup page, that haven’t been referred by any of your other pages, or have an empty user agent string (identifying the software making the request), and sends them to endless hell.


This code finally solved my problem. From the log, I can see the requirsts from spammers for my register page gets 0 bytes loaded, bandwidth saved. Spammers loss the war.


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.