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.

  • .htaccess, web development
  • 7 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Relaterade artiklar

Preventing bandwidth theft using .htaccess

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

Blocking users by IP address using .htaccess

Should you find that a few unruly visitors are causing you problems by posting unwanted messages...

Directory protection using .htaccess

One of the more common/popular uses of .htaccess is to password protect specific directories...

Creating custom error pages using .htaccess

One of the many things one can do to make their website a little more professional-looking is to...

Redirection using .htaccess

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