Go Back   vBulletin Setup > vBulletinSetup Information > Community Forum Management

Reply 
 
LinkBack Thread Tools Display Modes
Old 05-23-2009, 09:19 AM   #1
Community Manager
Supporters
vBulletin Owner
vBSetup Mods
 
Brandon Sheley's Avatar
 
Join Date: Jul 2006
Location: Topeka, KS
Posts: 14,114
Blog Entries: 35
Brandon Sheley is a splendid one to beholdBrandon Sheley is a splendid one to beholdBrandon Sheley is a splendid one to beholdBrandon Sheley is a splendid one to beholdBrandon Sheley is a splendid one to beholdBrandon Sheley is a splendid one to behold
Send a message via AIM to Brandon Sheley Send a message via MSN to Brandon Sheley Send a message via Yahoo to Brandon Sheley
Banishing Spammers and Trolls With .htaccess Files

Are you plagued by spammers and trolls inside of the comments section of your blog? If you are, I want to give you a simple little trick to kick them off your blog and keep them out by blocking their IP address.
I decided to use this technique on my own site when I noticed that 80% of my comment spam was coming from about five IP addresses. Enough was enough, although I was capturing the spammers using Akismet, I wanted to stop these people in their tracks. They were not welcome on my site.
This post is written with a WordPress bias, but check out your webserver and if it uses .htaccess there is a good chance you can adopt the techinques described here.
What is the .htaccess file?

The .htacess file is a web server level configuration file which sets certain rules for visitors to your site. It works at a level below WordPress (or any other blogging platform) analyses certain aspects of your web browsers interaction with the web server and if certain rules are met, you can generate an action.
In the example I am about to show, the rule is to check an IP address and the action is to restrict access.
.htaccess configuration is a huge topic. It can be used for redirection and a host of other functions. Much deeper reading can be found at Apache Tutorial: .htaccess files - Apache HTTP Server
Finding The Offenders IP address

WordPress does a great job helping you to discover the commentors IP address. Simply go to the comment section in your WordPress dashboard or to your spam moderation folder and below the email address and website is the IP address of the commentor. This is collected by WordPress for you.
Editing Your .htacess file

Lets start with a word of warning you can seriously damage your blog if you amend .htaccess incorrectly so take a backup of your file before you make any changes. I like to download the file to my local machine take a copy and edit the the original before uploading it back to my web server.
Some geekery for you, on unix or linux systems any file begining with a full stop/period is marked as a hidden file, and you will probably not be able to see the .htaccess file in the root of your WordPress installation by default. You will need to enable hidden files on your ftp client. I use Filezilla and that is located under server -> force show hidden files. Your ftp client will vary but the option will be there somewhere.
The default .htaccess file

A default WordPress .htaccess file will look like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
As you can see it has a number of re-write rules for wordpress and very little else.
What To Add

To block a particular IP address add the following lines below the #END WordPress section, replacing the details inside of {} with real IP addresses or host names.
#block spammers and troll’s IP addresses
order allow,deny
deny from {IP ADDRESS}
deny from {SECOND IP ADDRESS ONE PER LINE}
deny from {YOU CAN ALSO USE DOMAIN NAME trollhostname.com}
allow from all
# END spammers and trolls
Edit your .htaccess file with a text editor add your exclusions then upload it back to the root of your blog installation overwriting the old .htacess file.
Testing Your Changes

Any IP address added to the exclusion list will not be allowed access to your web server and a 403 forbidden message will be returned. The message from my web server is shown below:
Forbidden
You don’t have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
You can test it works by leaving a test comment on your blog getting your IP address and adding it the the .htaccess file. Remember to take it out again or you will not have access to your blog.
It is Not Fool Proof

This work around is not fool proof, it comes with some limitations and they are:
  • Proxies - if you offender is behind a proxy IP address then anybody else using that same address will be banned. Some ISPs will use a shared IP address so everyone using that ISP will be banned from yoru site. Use with care.
  • Spoofing IP address - if your troll is particularly tech litereate they could spoof their IP address or use another one, they will then get through your barrier.
Using another machine - your troublesome visitor could simply go to a friends machine or to an internet cafe and get a new IP address.
Wrap Up

As mentioned this is not a fool proof way to stop offenders, but blocking IP addresses is a great way of stopping comment bots from fixed addresses and a way of sending out a real warning to trolls that there type of comments are not welcome.
If you use this trick in conjunction with anti-spam plugins and comment moderation techniques you should be able to reduce your spam and deter trolls.

Source ProBlogger
Banishing Spammers and Trolls With .htaccess Files
__________________
Brandon Sheley / vBulletinSetup Staff
Check the Newsletter & Marketplace for the latest deals.
Looking for a place to Support vBulletinSetup?
Submit your Forum and other Quality Websites.


Brandon Sheley is offline   Reply With Quote

Advertisement [Remove Advertisement]

Old 05-23-2009, 10:33 AM   #2
vBulletin Owner
 
ArnyVee's Avatar
 
Join Date: Apr 2008
Location: South Florida
Posts: 2,883
Blog Entries: 1
ArnyVee is just really niceArnyVee is just really niceArnyVee is just really nice
Send a message via AIM to ArnyVee Send a message via Yahoo to ArnyVee Send a message via Skype™ to ArnyVee
Re: Banishing Spammers and Trolls With .htaccess Files

Wow, I need to read this in detail at a later date as I'm headed out the door. Thanks for sharing!
ArnyVee is offline   Reply With Quote
Old 05-26-2009, 08:07 AM   #3
vBulletin Owner
 
Join Date: May 2009
Posts: 8
Gingersnap will become famous soon enough
Re: Banishing Spammers and Trolls With .htaccess Files

My forum is private, so I've used htaccess to block a huge range of IPs and spambots.
Gingersnap is offline   Reply With Quote
Reply 
vBulletin Setup > vBulletinSetup Information > Community Forum Management

Tags
banishing, files, htaccess, spammers, trolls

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to handle proxy trolls. Chelf Community Forum Management 5 01-29-2010 04:29 PM
Spammers in Albums Rocket 442 Troubleshooting vBulletin Problems 2 05-16-2009 05:12 AM
Porn spammers on my site NickG vBulletin Services 1 10-02-2008 02:22 PM
How do you handle trolls Caddyman Community Forum Management 11 09-28-2008 11:14 PM
New York Times article on trolls Soliloquy Community Forum Management 1 08-03-2008 05:47 PM


All times are GMT -8. The time now is 02:30 AM.