Introduction to .htaccess
What is .htaccess?
The Apache Web server utilizes a per-directory access and configuration system under which users can modify and control various aspects of their particular website's operation by creating .htaccess files.
A .htaccess file is simply a text file containing commands referred to as Apache directives. Those directives apply to and effect the files in the directory where the .htaccess file is located as well as to all subdirectories below it.
What can I do using .htaccess files?
.htaccess files can be a very powerful and versatile tool. The list of things one can accomplish using .htaccess includes:
- password protect specific directories
- set up custom error pages
- disable directory listings
- specify alternate index files
- ban users by IP address
- prevent bandwidth theft via 'hotlinking'
- redirect to specific pages automatically
- add MIME types
- parse .html/.htm files for php code
Some of these features (password protection, custom error pages, MIME types) have been automated by controls integrated into cPanel and one can take advantage of these options without manually creating and editing .htaccess files, however the others must be implemented on a DIY basis.
Things To Note
- While HostRocket permits customers to modify and use .htaccess, as a general rule, no technical support is provided for .htaccess customization. While all of the .htaccess information discussed in these FAQs has been tested and verified as working, no guarantees are offered as far as every tip working at all times on every account.
- Users of Microsoft Frontpage who have Frontpage Extensions enabled on their accounts should exercise particular caution if they are considering performing any .htaccess modification as there is a risk of corrupting the Frontpage Extensions.
Was this answer helpful?
One of the many things one can do to make their website a little more professional-looking is to...
To modify/add directives to the .htaccess file in your public_html directory using "File...
By default our servers will look for (in order) a file by the name of index.html, index.cgi,...
By default when accessing any directory which does not contain an index file (ex:...
Should you find that a few unruly visitors are causing you problems by posting unwanted messages...