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.

  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

How to create a user-friendly URL using .htaccess?

If your website is using a long URL like, you can change it...

Setting a default index page using .htaccess

By default our servers will look for (in order) a file by the name of index.html, index.cgi,...

How to redirect a page to another page or website using .htaccess?

If a page on your website no longer exists and you want to redirect it to your new page or...

Redirection using .htaccess

Most websites are constantly changing "works in progress" and as one updates, rearranges and...

Preventing bandwidth theft using .htaccess

While all HostRocket plans include plenty of bandwidth (transfer) nobody ever has enough...