An .htaccess file is the Apache Web servers configuration file
No Comments
Written by Robert on August 17, 2008 – 9:15 pm
Modifying your (new) Web server’s functionality is possible through the use of an .htaccess file. An .htaccess file is the Apache Web server’s configuration file. It is a straightforward yet powerful text file that can accomplish a wide variety of functions. It enables you to protect your Web site from content-stealing robots and allows you to dynamically rewrite poorly formed URLs generated by shopping cart or blog software. Most Web site owners have never seen an .htaccess file or know of its existence. Although normally left to expert server administrators, an .htaccess file can help you avoid several potential problems.
An .htaccess file is the configuration file for the Apache Web server. It allows you to control the functionality of your server and has many other uses, including rewriting URLs and redirecting Web traffic. It enables you to use numerous forms of protection ranging from password protecting directories, banning visitors from certain sources, and preventing bandwidth theft from image linkers.

An .htaccess file is a simple text file, and it can be created in any simple text editor, such as Notepad. It can be uploaded to the root directory of your Web server or any directories underneath it.
Rules located in an .htaccess file uploaded to your images directory take precedence over the root file. Take full advantage of the server modification effects of .htaccess, and you can prevent your hard work from being abused or even stolen.
Protect Yourself with an .htaccess File
At some point, you may find that you are receiving an excessive amount of Web traffic from bots that are unrelated to search engines. There are hundreds of bots crawling the Web for a variety of reasons ranging from archiving Web content to collecting Web content to be used in spamming engines. Although normally harmless, these bots can eat up an impressive amount of bandwidth as your site becomes further established.
Prevent this by using .htaccess to ban these bots. If your Web site contains a large number of images or videos, other Webmasters may link directly to your images. Although the intent may be harmless, you may find that this also is eating a large amount of bandwidth. You can use .htaccess to block direct linking to your images, and instead even send a replacement image that relays a message to the offending Webmaster that you are not happy with his practices.
An excellent tool located at www.htaccesstools.com allows you to generate a variety of different .htaccess code blocks, which you can place into a blank .htaccess file and upload to your server. The tool automatically generates .htaccess authentication code along with an encrypted .htpasswd file to password protect directories. If you want to protect your images, it allows you to customize .htaccess code to allow certain domains to use your images, as well as define a replacement image that appears instead of the actual image requested.
Some Webmasters have fun with this prospect and generate an image that explicitly depicts their anger at having their images stolen. This is especially important with the advent of new image search engines like Google Images. The rising popularity of these engines leaves your images at risk. The tool also creates .htaccess code to block unwanted bot traffic or traffic from certain IP addresses. You should view your Web statistics regularly to check for excessive traffic from random bots or excessive visits from any particular IP addresses.







