Lably
Skip to content

.htaccess

Directory-level configuration file used by Apache HTTP Server

  • 3 min read
  • 5 chapters

Related on Lably

Through Web server, Character encoding and Authorization

A site may contain more than one .htaccess file. The files are placed inside the web tree—inside directories and their subdirectories—which is why they are also called distributed configuration files.

Each .htaccess file acts as a local override of the server's main configuration file (such as httpd.conf) for the directory it occupies and all subdirectories beneath it.

The original purpose—reflected in the name—was per-directory access control, for example requiring a password to reach web content. In practice .htaccess files are now used to configure many other settings: content types, character encoding, CGI handlers, and URL rewriting rules.

History

The .htaccess file format originated with the NCSA HTTPd server, where it was introduced to let shared-hosting users control access to their own directories without modifying the server-wide configuration. When the Apache HTTP Server project was founded in 1995 as a continuation of NCSA HTTPd, it retained the format and filename for compatibility. Other web servers, including Oracle iPlanet Web Server and the Zeus Web Server, later added .htaccess support even though their native configuration formats differ substantially.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Computing and communication