What is .htaccess?

Hypertext Access, commonly shortened to htaccess. .htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn ‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. It’s an incredibly useful feature which allows webmasters to control how many aspects of their website works. You can 301 redirect pages, change the extensions of pages, rewrite urls, password protect directories, Error Document 404 redirect and much much more.

Using an .htaccess file, you can:

  1.     Customize the Error pages for your site.
  2.     Protect your site with a password.
  3.     Enable server-side includes.
  4.     Deny access to your site based on IP.
  5.     Change your default directory page (index.html).
  6.     Redirect visitors to another page.
  7.     Prevent directory listing.
  8.     Add MIME types.

.htaccess files are a simple ASCII text file with the name .htaccess. It is not an extension like .html or .txt. The entire file name is .htaccess. For more information on how to set up .htaccess files, visit Apache’s website.

The most common uses of .htaccss are to changed the DirectoryIndex and to enable apache’s mod_rewrite module to get user and search engine friendly url’s, but there are many other uses.