Stop those Spammers from spamming your blogs using Apache tricks! I also would recommend Akismet and possibly spam karma...
Rename your /blog/wp-comments-post.php to /blog/cpost.php or something
RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} ^/?wp-comments-post.php.* RewriteCond %{HTTP_REFERER} !^https://www.askapache.com [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule .* - [F]
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] RewriteCond %{HTTP_USER_AGENT} ^Bot mailto:craftbot@yahoo.com [OR] RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] RewriteCond %{HTTP_USER_AGENT} ^Custo [OR] RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] RewriteCond %{HTTP_USER_AGENT} ^Download Demon [OR] RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR] RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR] RewriteCond %{HTTP_USER_AGENT} ^Express WebPictures [OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR] RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR] RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR] RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR] RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR] RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR] RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR] RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR] RewriteCond %{HTTP_USER_AGENT} ^HMView [OR] RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^Image Stripper [OR] RewriteCond %{HTTP_USER_AGENT} ^Image Sucker [OR] RewriteCond %{HTTP_USER_AGENT} Indy Library [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR] RewriteCond %{HTTP_USER_AGENT} ^Internet Ninja [OR] RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR] RewriteCond %{HTTP_USER_AGENT} ^JOC Web Spider [OR] RewriteCond %{HTTP_USER_AGENT} ^larbin [OR] RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR] RewriteCond %{HTTP_USER_AGENT} ^Mass Downloader [OR] RewriteCond %{HTTP_USER_AGENT} ^MIDown tool [OR] RewriteCond %{HTTP_USER_AGENT} ^Mister PiX [OR] RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR] RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR] RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR] RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Net Vampire [OR] RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR] RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR] RewriteCond %{HTTP_USER_AGENT} ^Offline Explorer [OR] RewriteCond %{HTTP_USER_AGENT} ^Offline Navigator [OR] RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^Papa Foto [OR] RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR] RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR] RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR] RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR] RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR] RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR] RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR] RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR] RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR] RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR] RewriteCond %{HTTP_USER_AGENT} ^Teleport Pro [OR] RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR] RewriteCond %{HTTP_USER_AGENT} ^Web Image Collector [OR] RewriteCond %{HTTP_USER_AGENT} ^Web Sucker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR] RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR] RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR] RewriteCond %{HTTP_USER_AGENT} ^WebGo IS [OR] RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR] RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR] RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR] RewriteCond %{HTTP_USER_AGENT} ^Website eXtractor [OR] RewriteCond %{HTTP_USER_AGENT} ^Website Quester [OR] RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR] RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR] RewriteCond %{HTTP_USER_AGENT} ^Wget [OR] RewriteCond %{HTTP_USER_AGENT} ^Widow [OR] RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR] RewriteCond %{HTTP_USER_AGENT} ^Xaldon WebSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Zeus RewriteRule .* - [F]http://www.webmasterworld.com/apache/3063811.htm
## .htaccess Code :: BEGIN ## Block Bad Bots by User-Agent SetEnvIfNoCase User-Agent ^$ bad_bot SetEnvIfNoCase User-Agent "^AESOP_com_SpiderMan" bad_bot SetEnvIfNoCase User-Agent "^Alexibot" bad_bot SetEnvIfNoCase User-Agent "Anonymouse.org" bad_bot SetEnvIfNoCase User-Agent "^asterias" bad_bot SetEnvIfNoCase User-Agent "^attach" bad_bot SetEnvIfNoCase User-Agent "^BackDoorBot" bad_bot SetEnvIfNoCase User-Agent "^BackWeb" bad_bot SetEnvIfNoCase User-Agent "Bandit" bad_bot SetEnvIfNoCase User-Agent "^Baiduspider" bad_bot SetEnvIfNoCase User-Agent "^BatchFTP" bad_bot SetEnvIfNoCase User-Agent "^Bigfoot" bad_bot SetEnvIfNoCase User-Agent "^Black.Hole" bad_bot SetEnvIfNoCase User-Agent "^BlackWidow" bad_bot SetEnvIfNoCase User-Agent "^BlowFish" bad_bot SetEnvIfNoCase User-Agent "^Bot mailto:craftbot@yahoo.com" bad_bot SetEnvIfNoCase User-Agent "^BotALot" bad_bot SetEnvIfNoCase User-Agent "Buddy" bad_bot SetEnvIfNoCase User-Agent "^BuiltBotTough" bad_bot SetEnvIfNoCase User-Agent "^Bullseye" bad_bot SetEnvIfNoCase User-Agent "^BunnySlippers" bad_bot SetEnvIfNoCase User-Agent "^Cegbfeieh" bad_bot SetEnvIfNoCase User-Agent "^CheeseBot" bad_bot SetEnvIfNoCase User-Agent "^CherryPicker" bad_bot SetEnvIfNoCase User-Agent "^ChinaClaw" bad_bot SetEnvIfNoCase User-Agent "Collector" bad_bot SetEnvIfNoCase User-Agent "Copier" bad_bot SetEnvIfNoCase User-Agent "^CopyRightCheck" bad_bot SetEnvIfNoCase User-Agent "^cosmos" bad_bot SetEnvIfNoCase User-Agent "^Crescent" bad_bot SetEnvIfNoCase User-Agent "^Curl" bad_bot SetEnvIfNoCase User-Agent "^Custo" bad_bot SetEnvIfNoCase User-Agent "^DA" bad_bot SetEnvIfNoCase User-Agent "^DISCo" bad_bot SetEnvIfNoCase User-Agent "^DIIbot" bad_bot SetEnvIfNoCase User-Agent "^DittoSpyder" bad_bot SetEnvIfNoCase User-Agent "^Download" bad_bot SetEnvIfNoCase User-Agent "^Download Demon" bad_bot SetEnvIfNoCase User-Agent "^Download Devil" bad_bot SetEnvIfNoCase User-Agent "^Download Wonder" bad_bot SetEnvIfNoCase User-Agent "Downloader" bad_bot SetEnvIfNoCase User-Agent "^dragonfly" bad_bot SetEnvIfNoCase User-Agent "^Drip" bad_bot SetEnvIfNoCase User-Agent "^eCatch" bad_bot SetEnvIfNoCase User-Agent "^EasyDL" bad_bot SetEnvIfNoCase User-Agent "^ebingbong" bad_bot SetEnvIfNoCase User-Agent "^EirGrabber" bad_bot SetEnvIfNoCase User-Agent "^EmailCollector" bad_bot SetEnvIfNoCase User-Agent "^EmailSiphon" bad_bot SetEnvIfNoCase User-Agent "^EmailWolf" bad_bot SetEnvIfNoCase User-Agent "^EroCrawler" bad_bot SetEnvIfNoCase User-Agent "^Exabot" bad_bot SetEnvIfNoCase User-Agent "^Express WebPictures" bad_bot SetEnvIfNoCase User-Agent "Extractor" bad_bot SetEnvIfNoCase User-Agent "^EyeNetIE" bad_bot SetEnvIfNoCase User-Agent "^FileHound" bad_bot SetEnvIfNoCase User-Agent "^FlashGet" bad_bot SetEnvIfNoCase User-Agent "^Foobot" bad_bot SetEnvIfNoCase User-Agent "^flunky" bad_bot SetEnvIfNoCase User-Agent "^FrontPage" bad_bot SetEnvIfNoCase User-Agent "^GetRight" bad_bot SetEnvIfNoCase User-Agent "^GetSmart" bad_bot SetEnvIfNoCase User-Agent "^GetWeb!" bad_bot SetEnvIfNoCase User-Agent "^Go!Zilla" bad_bot SetEnvIfNoCase User-Agent "Google Wireless Transcoder" bad_bot SetEnvIfNoCase User-Agent "^Go-Ahead-Got-It" bad_bot SetEnvIfNoCase User-Agent "^gotit" bad_bot SetEnvIfNoCase User-Agent "Grabber" bad_bot SetEnvIfNoCase User-Agent "^GrabNet" bad_bot SetEnvIfNoCase User-Agent "^Grafula" bad_bot SetEnvIfNoCase User-Agent "^Harvest" bad_bot SetEnvIfNoCase User-Agent "^hloader" bad_bot SetEnvIfNoCase User-Agent "^HMView" bad_bot SetEnvIfNoCase User-Agent "^httplib" bad_bot SetEnvIfNoCase User-Agent "^HTTrack" bad_bot SetEnvIfNoCase User-Agent "^humanlinks" bad_bot SetEnvIfNoCase User-Agent "^ia_archiver" bad_bot SetEnvIfNoCase User-Agent "^IlseBot" bad_bot SetEnvIfNoCase User-Agent "^Image Stripper" bad_bot SetEnvIfNoCase User-Agent "^Image Sucker" bad_bot SetEnvIfNoCase User-Agent "Indy Library" bad_bot SetEnvIfNoCase User-Agent "^InfoNaviRobot" bad_bot SetEnvIfNoCase User-Agent "^InfoTekies" bad_bot SetEnvIfNoCase User-Agent "^Intelliseek" bad_bot SetEnvIfNoCase User-Agent "^InterGET" bad_bot SetEnvIfNoCase User-Agent "^Internet Ninja" bad_bot SetEnvIfNoCase User-Agent "^Iria" bad_bot SetEnvIfNoCase User-Agent "^Jakarta" bad_bot SetEnvIfNoCase User-Agent "^JennyBot" bad_bot SetEnvIfNoCase User-Agent "^JetCar" bad_bot SetEnvIfNoCase User-Agent "^JOC" bad_bot SetEnvIfNoCase User-Agent "^JustView" bad_bot SetEnvIfNoCase User-Agent "^Jyxobot" bad_bot SetEnvIfNoCase User-Agent "^Kenjin.Spider" bad_bot SetEnvIfNoCase User-Agent "^Keyword.Density" bad_bot SetEnvIfNoCase User-Agent "^larbin" bad_bot SetEnvIfNoCase User-Agent "^LeechFTP" bad_bot SetEnvIfNoCase User-Agent "^LexiBot" bad_bot SetEnvIfNoCase User-Agent "^lftp" bad_bot SetEnvIfNoCase User-Agent "^libWeb/clsHTTP" bad_bot SetEnvIfNoCase User-Agent "^likse" bad_bot SetEnvIfNoCase User-Agent "^LinkextractorPro" bad_bot SetEnvIfNoCase User-Agent "^LinkScan/8.1a.Unix" bad_bo SetEnvIfNoCase User-Agent "^LNSpiderguy" bad_bott SetEnvIfNoCase User-Agent "^LinkWalker" bad_bot SetEnvIfNoCase User-Agent "^lwp-trivial" bad_bot SetEnvIfNoCase User-Agent "^LWP::Simple" bad_bot SetEnvIfNoCase User-Agent "^Magnet" bad_bot SetEnvIfNoCase User-Agent "^Mag-Net" bad_bot SetEnvIfNoCase User-Agent "^MarkWatch" bad_bot SetEnvIfNoCase User-Agent "^Mass Downloader" bad_bot SetEnvIfNoCase User-Agent "^Mata.Hari" bad_bot SetEnvIfNoCase User-Agent "^Memo" bad_bot SetEnvIfNoCase User-Agent "^Microsoft.URL" bad_bot SetEnvIfNoCase User-Agent "^Microsoft URL Control" bad_bot SetEnvIfNoCase User-Agent "^MIDown tool" bad_bot SetEnvIfNoCase User-Agent "^MIIxpc" bad_bot SetEnvIfNoCase User-Agent "^Mirror" bad_bot SetEnvIfNoCase User-Agent "^Missigua Locator" bad_bot SetEnvIfNoCase User-Agent "^Mister PiX" bad_bot SetEnvIfNoCase User-Agent "^moget" bad_bot SetEnvIfNoCase User-Agent "^Mozilla/3.Mozilla/2.01" bad_bot SetEnvIfNoCase User-Agent "^Mozilla.*NEWT" bad_bot SetEnvIfNoCase User-Agent "^NAMEPROTECT" bad_bot SetEnvIfNoCase User-Agent "^Navroad" bad_bot SetEnvIfNoCase User-Agent "^NearSite" bad_bot SetEnvIfNoCase User-Agent "^NetAnts" bad_bot SetEnvIfNoCase User-Agent "^Netcraft" bad_bot SetEnvIfNoCase User-Agent "^NetMechanic" bad_bot SetEnvIfNoCase User-Agent "^NetSpider" bad_bot SetEnvIfNoCase User-Agent "^Net Vampire" bad_bot SetEnvIfNoCase User-Agent "^NetZIP" bad_bot SetEnvIfNoCase User-Agent "^NextGenSearchBot" bad_bot SetEnvIfNoCase User-Agent "^NG" bad_bot SetEnvIfNoCase User-Agent "^NICErsPRO" bad_bot SetEnvIfNoCase User-Agent "^NimbleCrawler" bad_bot SetEnvIfNoCase User-Agent "^Ninja" bad_bot SetEnvIfNoCase User-Agent "^NPbot" bad_bot SetEnvIfNoCase User-Agent "^Octopus" bad_bot SetEnvIfNoCase User-Agent "^Offline Explorer" bad_bot SetEnvIfNoCase User-Agent "^Offline Navigator" bad_bot SetEnvIfNoCase User-Agent "^Openfind" bad_bot SetEnvIfNoCase User-Agent "^OutfoxBot" bad_bot SetEnvIfNoCase User-Agent "^PageGrabber" bad_bot SetEnvIfNoCase User-Agent "^Papa Foto" bad_bot SetEnvIfNoCase User-Agent "^pavuk" bad_bot SetEnvIfNoCase User-Agent "^pcBrowser" bad_bot SetEnvIfNoCase User-Agent "^PHP version tracker" bad_bot SetEnvIfNoCase User-Agent "^Pockey" bad_bot SetEnvIfNoCase User-Agent "^ProPowerBot/2.14" bad_bot SetEnvIfNoCase User-Agent "^ProWebWalker" bad_bot SetEnvIfNoCase User-Agent "^psbot" bad_bot SetEnvIfNoCase User-Agent "^Pump" bad_bot SetEnvIfNoCase User-Agent "^QueryN.Metasearch" bad_bot SetEnvIfNoCase User-Agent "^RealDownload" bad_bot SetEnvIfNoCase User-Agent "Reaper" bad_bot SetEnvIfNoCase User-Agent "Recorder" bad_bot SetEnvIfNoCase User-Agent "^ReGet" bad_bot SetEnvIfNoCase User-Agent "^RepoMonkey" bad_bot SetEnvIfNoCase User-Agent "^RMA" bad_bot SetEnvIfNoCase User-Agent "Siphon" bad_bot SetEnvIfNoCase User-Agent "sitecheck.internetseer.com" bad_bot SetEnvIfNoCase User-Agent "^SiteSnagger" bad_bot SetEnvIfNoCase User-Agent "^SlySearch" bad_bot SetEnvIfNoCase User-Agent "^SmartDownload" bad_bot SetEnvIfNoCase User-Agent "^Snake" bad_bot SetEnvIfNoCase User-Agent "^Snapbot" bad_bot SetEnvIfNoCase User-Agent "^Snoopy" bad_bot SetEnvIfNoCase User-Agent "^sogou" bad_bot SetEnvIfNoCase User-Agent "^SpaceBison" bad_bot SetEnvIfNoCase User-Agent "^SpankBot" bad_bot SetEnvIfNoCase User-Agent "^spanner" bad_bot SetEnvIfNoCase User-Agent "^Sqworm" bad_bot SetEnvIfNoCase User-Agent "Stripper" bad_bot SetEnvIfNoCase User-Agent "Sucker" bad_bot SetEnvIfNoCase User-Agent "^SuperBot" bad_bot SetEnvIfNoCase User-Agent "^SuperHTTP" bad_bot SetEnvIfNoCase User-Agent "^Surfbot" bad_bot SetEnvIfNoCase User-Agent "^suzuran" bad_bot SetEnvIfNoCase User-Agent "^Szukacz/1.4" bad_bot SetEnvIfNoCase User-Agent "^tAkeOut" bad_bot SetEnvIfNoCase User-Agent "^Teleport" bad_bot SetEnvIfNoCase User-Agent "^Telesoft" bad_bot SetEnvIfNoCase User-Agent "^TurnitinBot/1.5" bad_bot SetEnvIfNoCase User-Agent "^The.Intraformant" bad_bot SetEnvIfNoCase User-Agent "^TheNomad" bad_bot SetEnvIfNoCase User-Agent "^TightTwatBot" bad_bot SetEnvIfNoCase User-Agent "^Titan" bad_bot SetEnvIfNoCase User-Agent "^toCrawl/UrlDispatcher" bad_bot SetEnvIfNoCase User-Agent "^True_Robot" bad_bot SetEnvIfNoCase User-Agent "^turingos" bad_bot SetEnvIfNoCase User-Agent "^TurnitinBot" bad_bot SetEnvIfNoCase User-Agent "^URLy.Warning" bad_bot SetEnvIfNoCase User-Agent "^Vacuum" bad_bot SetEnvIfNoCase User-Agent "^VCI" bad_bot SetEnvIfNoCase User-Agent "^VoidEYE" bad_bot SetEnvIfNoCase User-Agent "^Web Image Collector" bad_bot SetEnvIfNoCase User-Agent "^Web Sucker" bad_bot SetEnvIfNoCase User-Agent "^WebAuto" bad_bot SetEnvIfNoCase User-Agent "^WebBandit" bad_bot SetEnvIfNoCase User-Agent "^Webclipping.com" bad_bot SetEnvIfNoCase User-Agent "^WebCopier" bad_bot SetEnvIfNoCase User-Agent "^WebEMailExtrac.*" bad_bot SetEnvIfNoCase User-Agent "^WebEnhancer" bad_bot SetEnvIfNoCase User-Agent "^WebFetch" bad_bot SetEnvIfNoCase User-Agent "^WebGo IS" bad_bot SetEnvIfNoCase User-Agent "^Web.Image.Collector" bad_bot SetEnvIfNoCase User-Agent "^WebLeacher" bad_bot SetEnvIfNoCase User-Agent "^WebmasterWorldForumBot" bad_bot SetEnvIfNoCase User-Agent "^WebReaper" bad_bot SetEnvIfNoCase User-Agent "^WebSauger" bad_bot SetEnvIfNoCase User-Agent "^WebSite" bad_bot SetEnvIfNoCase User-Agent "^Website eXtractor" bad_bot SetEnvIfNoCase User-Agent "^Website Quester" bad_bot SetEnvIfNoCase User-Agent "^Webster" bad_bot SetEnvIfNoCase User-Agent "^WebStripper" bad_bot SetEnvIfNoCase User-Agent "^WebWhacker" bad_bot SetEnvIfNoCase User-Agent "^WebZIP" bad_bot SetEnvIfNoCase User-Agent "^Wget" bad_bot SetEnvIfNoCase User-Agent "Whacker" bad_bot SetEnvIfNoCase User-Agent "^Widow" bad_bot SetEnvIfNoCase User-Agent "^WISENutbot" bad_bot SetEnvIfNoCase User-Agent "^WWWOFFLE" bad_bot SetEnvIfNoCase User-Agent "^WWW-Collector-E" bad_bot SetEnvIfNoCase User-Agent "^Xaldon" bad_bot SetEnvIfNoCase User-Agent "^Xenu" bad_bot SetEnvIfNoCase User-Agent "^Zeus" bad_bot SetEnvIfNoCase User-Agent "^Zyborg" bad_bot Order Allow,Deny Allow from all Deny from env=bad_bothttp://www.webmasterworld.com/apache/3213389.htm
SetEnvIfNoCase User-Agent "^Web Image Collector" bad_bot SetEnvIfNoCase User-Agent "^Web Sucker" bad_bot SetEnvIfNoCase User-Agent "^WebAuto" bad_bot SetEnvIfNoCase User-Agent "^WebBandit" bad_bot SetEnvIfNoCase User-Agent "^Webclipping.com" bad_bot SetEnvIfNoCase User-Agent "^WebCopier" bad_bot SetEnvIfNoCase User-Agent "^WebEMailExtrac.*" bad_bot SetEnvIfNoCase User-Agent "^WebEnhancer" bad_bot SetEnvIfNoCase User-Agent "^WebFetch" bad_bot SetEnvIfNoCase User-Agent "^WebGo IS" bad_bot SetEnvIfNoCase User-Agent "^Web.Image.Collector" bad_bot SetEnvIfNoCase User-Agent "^WebLeacher" bad_bot SetEnvIfNoCase User-Agent "^WebmasterWorldForumBot" bad_bot SetEnvIfNoCase User-Agent "^WebReaper" bad_bot SetEnvIfNoCase User-Agent "^WebSauger" bad_bot SetEnvIfNoCase User-Agent "^WebSite" bad_bot SetEnvIfNoCase User-Agent "^Website eXtractor" bad_bot SetEnvIfNoCase User-Agent "^Website Quester" bad_bot SetEnvIfNoCase User-Agent "^Webster" bad_bot SetEnvIfNoCase User-Agent "^WebStripper" bad_bot SetEnvIfNoCase User-Agent "^WebWhacker" bad_bot SetEnvIfNoCase User-Agent "^WebZIP" bad_bot hybrid, You may reduce twenty-one lines down to a single line with the following: SetEnvIfNoCase User-Agent ^Web bad_bothttp://www.garnetchaney.com/htaccess_tips_and_tricks.shtml http://www.tomrafteryit.net/htaccess.txt http://www.tomrafteryit.net/using-htaccess-to-minimise-comment-and-referrer-spam/
Also, Cindy alerted me to the fact that adding: RewriteCond %{HTTP:VIA} ^.+pinappleproxy [NC] RewriteRule .* - [F] Will also catch a lot of the spammers.
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} *wp-comments-post.php* RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule (.*) http://www.anywhere.com/$ [R=301,L]
say you want to block a spammer that use always the same ip
deny from 192.168.0.1http://forums.feedburner.com/viewtopic.php?t=17 http://forums.feedburner.com/viewtopic.php?t=14
When your readers comment, the wp-comments-post.php file is accessed, does its thing, and creates the post. The user's browser will send a "referral" line about this.
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
This will: 1. Detect when a POST is being made 2. Check to see if the post is on wp-comments-post.php 3. Check if the referrer is in your domain or if no referrer 4. Send the spam-bot BACK to its originating server's IP address. NOTE 1: In the 4th line, change yourdomain.com to your domain.xxx without the www or any prefix for that matter. NOTE 2: There is a slim chance that someone's browser will not send the referral, but this is extremely rare. This essentially deflects the spam-bot back on itself.SetEnvIfNoCase Via evil-spam-proxy spammer=yes SetEnvIfNoCase Referer evil-spam-domain.com spammer=yes SetEnvIfNoCase Referer evil-spam-keyword spammer=yes SetEnvIfNoCase Via pinappleproxy spammer=yes SetEnvIfNoCase Referer doobu.com spammer=yes SetEnvIfNoCase Referer poker spammer=yes Order allow,deny allow from all deny from env=spammer
# Tom Raftery's .htaccess file - use with caution - for more info on writing .htaccess files # see http://www.tomrafteryit.net/category/htaccess/ # Last updated 4th Oct 05 Options +FollowSymlinks RewriteEngine On php_flag register_globals off # There was a lot of comment spam with the User Agents Crazy Browser 1.x.x and Mozilla/3.0 (compatible; Indy Library) # so I am using the following code to block it. Note that I removed the starting "^", so that it will ban # any user-agent with "Indy Library" or "TrackBack" anywhere in its user-agent string, and that it will # accept any character - including a space - after "Indy" or TrackBack. RewriteCond %{HTTP_USER_AGENT} Indy.Library [NC,OR] RewriteCond %{HTTP_USER_AGENT} TrackBack [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^Crazy Browser [NC] RewriteRule .* - [F] # There was a lot of referrer spam coming from 12.163.72.13 (no uri) # so I decided to block it with the following code RewriteCond %{REMOTE_ADDR} ^12.163.72.13$ RewriteRule .* - [F,L] # A new tactic - using SetEnvIfNoCase instead of RewriteCond - seems to be quite effective (esp for referrers). # Original version found at http://blog.koehntopp.de/archives/671-Mehr-ueber-den-Trackback-Spammer.html # Many spams and trackbacks come from User Agent Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90) # I added a line (SetEnvIfNoCase User-Agent 9x 4.90 spammer=yes) to deny this User Agent - be aware that if you # include this line you risk banning some genuine browsers, although I could find no genuine browsers using that UA in my logs SetEnvIfNoCase X-AAAAAAAAAAAA 1 spammer=yes SetEnvIfNoCase Via pinappleproxy spammer=yes SetEnvIfNoCase Referer yelucie.com spammer=yes SetEnvIfNoCase Referer crescentarian.net spammer=yes SetEnvIfNoCase Referer andrewsaluk.com spammer=yes SetEnvIfNoCase Referer tigerspice spammer=yes SetEnvIfNoCase Referer doobu.com spammer=yes SetEnvIfNoCase Referer camfun24 spammer=yes SetEnvIfNoCase Referer latinonakedgirl spammer=yes SetEnvIfNoCase Referer ronnieazza.com spammer=yes SetEnvIfNoCase Referer highprofitclub spammer=yes SetEnvIfNoCase Referer dvdsqueeze.com spammer=yes SetEnvIfNoCase Referer sexsearchcom.com spammer=yes SetEnvIfNoCase Referer 6q.org spammer=yes SetEnvIfNoCase Referer d4f.de spammer=yes SetEnvIfNoCase Referer adultactioncam spammer=yes SetEnvIfNoCase Referer seventwentyfour.com spammer=yes SetEnvIfNoCase Referer genaholincorporated.com spammer=yes SetEnvIfNoCase Referer firsthorizonmtg.com spammer=yes SetEnvIfNoCase Referer personalsites.info spammer=yes SetEnvIfNoCase Referer bukakke-bukake-bukkake-bukkakke.com spammer=yes SetEnvIfNoCase Referer camgirlslive.com spammer=yes SetEnvIfNoCase Referer dvd-copy.com spammer=yes SetEnvIfNoCase Referer shaffelrecords.com spammer=yes SetEnvIfNoCase Referer mcr8.com spammer=yes SetEnvIfNoCase Referer dating.blogs.com spammer=yes SetEnvIfNoCase Referer online-casino-pops spammer=yes SetEnvIfNoCase Referer 8thstreetlatinas spammer=yes SetEnvIfNoCase Referer boysfirsttime.com spammer=yes SetEnvIfNoCase Referer gofordgo.com spammer=yes SetEnvIfNoCase Referer buy-hgh-human-growth-hormone.net spammer=yes deny from env=spammer deny from 66.28.54.254 deny from 12.163.72.13 deny from 71.57.133.162 deny from 84.92.124.116 deny from 196.7.0.160 deny from 210.43.0.225 deny from 219.93.174.107 deny from 205.134.241.50 # From Spamhuntress - code to deny the below user agents POST access to trackback SetEnvIf User-Agent "Mozilla" trackers SetEnvIf User-Agent "Opera" trackers SetEnvIf User-Agent ^$ trackers Order Allow,Deny Allow from all Deny from env=trackershttp://underscorebleach.net/jotsheet/2005/01/referrer-spam-proposal