Web Design & Development Guide

conceptualization, planning, modeling, and execution of electronic media delivery via internet in the form of markup language suitable for interpretation by web browser and display as graphical user interface

.htaccess

.htaccess (Hypertext Access) is the default name of Apache's directory-level configuration file. It provides the ability to customize configuration directives defined in the main configuration file. The configuration directives need to be in .htaccess context and the user needs appropriate permissions.

Error documents

Statements such as the following can be used to configure a server to send out customized documents in response to client errors such as "404 Not Found" or server errors such as "503: Service Temporarily Unavailable"

ErrorDocument 404 /error-pages/not-found.html
ErrorDocument 503 /error-pages/service-unavailable.html

Directory rules

A .htaccess file controls the directory it is in, plus all subdirectories. However, by placing additional .htaccess files in the subdirectories, this can be overruled.

User permissions

The user permissions for .htaccess are controlled on server level with the AllowOverride directive which is documented in the Apache Server Documentation.

Other uses

Some web developers have modified .htaccess to perform custom tasks server-side before serving content to the browser. Developer Shaun Inman shows it is possible to edit .htaccess to allow for Server Side Constants within CSS.

External links

Back | Home | Up | Next

Menu

Back | Home | Up | Next

Home
Up

News

Bookmark and Share