How To Use Your .htaccess File To Keep Spammers Out

Spammers have a knack for developing "overrides" toaccess the site has to be created. It is placed
even the most secured aspect of the system includinganywhere within the website although it is advisable to
those that are not readily recognized as potentialstore it outside the web root so that it cannot be
targets. The .htaccess file can be used to keep e-mailaccessed from the web.
harvesters away. This is considered very effectiveRecommended Practices to Deter Spam
since all of these harvesters get to identify themselvesAvoiding the publication of referrers is one way of
in some way using the user agent files which givesdiscouraging spammers. It would be pointless to bother
.htaccess the capability to block them.sending spoofed requests to blogs when this
Spams Countered by .htaccessinformation is not known. Unfortunately, most bloggers
Bad bots are the spiders that are considered to do abelieve that being able to click on a link such as "sites
lot more harm than good to a site such as an e-mailreferring to me" and the like is a neat feature and
harvester. Site rippers are offline browsing programshave not evaluated its detrimental effect on the whole
that a surfer may unleash on a site to crawl andblogosphere.
download every one of its pages for offline viewing.If publishing referrers is a definite must, there should be
Both cases would result to a jacking up a site'sa built-in support for a referral spam blacklist and
bandwidth and resource usage even up to the point ofinclude the page in robots.txt. It specifically tells
crashing the site's server. Since bad bots wouldGooglebot and its relatives not to index the referrer's
typically ignore the wishes of ones' robots.txtfile theypage. By doing this, spammers are unable to get the
can be banned using the .htaccess essentially bypage rank they seek. This would only work however,
identifying the bad bots.when referrers are published separately from the
There is a useful code block that can be inserted intorests of the site's content.
the .htaccess file for blocking a lot of the known badThe use of rel = "no follow" likewise denies the
bots and site rippers currently existing. Affected botsspammers of their desired page rank at the link-level
will receive a 403 Forbidden Error when they attemptand not just the page-level using robots.txt. All link
to view a protected site. This usually results to areferrer section of the website linking to external
significant bandwidth saving and decrease in serverwebsites should carry this attribute. This is done
resource usage.without exception so as to offer maximum protection.
Bandwidth stealing or what is commonly referred to asReferrer statistics gathered from beacon images
hot linking in the web community refers to linkingloaded via JavaScript document, write statements that
directly to non-HTML objects that are not on one'sare more reliable than what the raw web server logs
own server such as images and CSS files. Thewill contain. There is an option to totally disregard the
victim's server is robbed of bandwidth and money asreferrer's section of a site's server logs. A cleaner list
the perpetrator enjoys showing content without havingof referrers can be gathered from the use of
to pay for its delivery.JavaScript and beacon images from referrer stats.
Hot linking to one's own server can be disallowed withThe current Master Blacklist File can be a powerful
the use of .htaccess. Those who will attempt to link anand efficient weapon against spam. A log file analysis
image or CSS file on a protected site is either blockedprogram that filters referrers against this list can help
or served a different content. Being blocked wouldroot out spam. The Master Blacklist is a simple text file
usually mean a failed request in the form of a brokenthat can be downloaded from a website or simply
image while an example of a different content wouldmirrored. It is far from perfect since a check on the file
be an image of an angry man, presumably to send aagainst the referrers that got through shows that few
clear message to the violators. It is necessary that theor none of them were listed.
mod rewrite is enabled on one's server in order for thisThe idea of combating comment spam by harnessing
aspect of .htaccess to work.DNS-based black hole lists could also be used to ferret
Disabling hot linking of certain file types on a site wouldout other forms of spam such as referral spam. The
need a code to the .htaccess file which will beproposal is really rather simple and suggests to query
uploaded to the root directory or a particularthe IP against a blacklist for a request with a referrer. If
subdirectory to localize the effect to just one sectionthe IP is blacklisted or has a high score among a
of the site. A server is typically set to preventmultitude of blacklist, listing the referring URL in any
directory listing. If this is not the case, the required linksection of a site's web stats should be refrained from.
should be stored into the .htaccess files of the imageOnce a given site has been identified as a referral
directory so that nothing in this directory will be allowedspam host name, querying the blacklist again for any
to be listed.IPs with the same host name in the HTTP request
The .htaccess file is also able to reliably passwordshould not be done as a matter of efficiency.
protect directories on websites. Other options can beThere are various forms of spam that has grown
used but only .htaccess offers total security. Anyoneexponentially along with the popularity of blogs. This is
wishing to get into the directory must know theprobably due to the very little restrictions given against
password and no "back doors" are provided.those that can post a comment. This is easily exploited
Password protection using .htaccess requires addingby spammers who are intent on getting their goods in
the approximate links to the .htaccess file in thefront of people's view. Spammers have automated
directory that is being sought to be protected.tools on a constant look-out for blogs that can easily
Password protecting a directory is one of thebe spammed. Spamming in all its forms, carry heavy
functions of .htaccess that takes a little more workconsequences for those trying to use the Internet and
than the others. This is because a file containing thethe world wide web in a productive way.
usernames and passwords which are allowed to