Bleadof’s world of tinkering

July 5, 2006

Ha! I defeated the evil Chinese spam bot!

Filed under: Apache, Tinkering — Bleadof @ 10:07

I’m been spammed by this Chinese spam bot. It tries to post on my non-existing guestbook by loading /?guestbook&action=write and generating dummy hits on my wordpress blog front page. Today I decided to stop that.

Ingredients

  • Apache
  • Apache mod_rewrite module
  • .htaccess love

Steps

  • 1. Create, if you don’t already have, a .htaccess file in your document root (ie. mine is /home/username/public_html/)
  • 2. Edit your .htaccess file and add following lines


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^guestbook&action=write$
RewriteRule ^index.php$ / [G]
</IfModule>

  • 3. Save

Now you are done and that url returns now 410 error code, which means the resource is gone.

Powered by WordPress