linux web hosting
The DocumentRoot Directive
The DocumentRoot directive sets the directory from which your web server serves files. Your web content should reside in this directory.

The following is an example:

DocumentRoot /usr/local/etc/httpd/htdocs

For more information, see the Apache Web Site Documentation on DocumentRoot Directive:

The DirectoryIndex Directive
When a URL request is received that does not explicitly identify a resource by name, (e.g. http://www.yourcompany.com), your web server will attempt to retrieve the files defined by the DirectoryIndex directive. Several files may be defined. The web server will return the first one that it finds.

The following is an example:

DirectoryIndex index.php index.htm default.htm

A request for http://www.yourcompany.com would return http://www.yourcompany.com/index.php if it existed, then http://www.yourcompany.com/index.htm if it existed, and so on until a match is found. If no match is found, then an index of the files contained in the directory is returned.

For more information, see the Apache Web Site documentation on Mod_dir:

The FancyIndexing, IndexOptions, AddIcon, and IndexIgnore Directives
As noted above, the DirectoryIndex directive identifies specific files that should be searched for when a URL request is received that does not explicitly identify a resource. If the DirectoryIndex search fails and the Indexes option is set for the requested directory (see the httpd.conf <Directory> directive), then an index of files is generated and served the client agent. There are several directives that define the display of such an index of files.

For more information, see the Apache Web Site Documentation:

The AccessFileName Directive
When returning a document to a client, the server looks for access control files in the requested resource directory as well as its parent directories. The AccessFileName directive sets the name of the file your web server will look for to find access control definitions. For more information about access control files, please see the "Password-Protecting a Directory" section later in this chapter.

The following is an example:

AccessFileName .htaccess

For more information, see the Apache Web Site Documentation on AccessFileName Directive:

The DefaultType Directive
The DefaultType directive defines a MIME type for resources on your web server that do not match file extensions found in your MIME types configuration file.

The following is an example:

DefaultType text/plain

For more information, see the Apache Web Site Documentation on the DefaultType Directive:

The AddLanguage Directive
The AddLanguage directive is used to identify resources written in a specific language with a file extension. The AddLanguage directive is essential for content negotiation, where the server returns one of several documents based on the language preference of the client browser. For more information about content negotiation, please see the "Serving Document Based on Language Preference" section later in this chapter.

The following is an example:

AddLanguage en .en

For more information, see the Apache Web Site Documentation on the AddLanguage Directive:

The LanguagePriority Directive
The LanguagePriority directive allows you to give precedence to some languages in case of a "tie" during content negotiation, or if the browser client does not specify a language priority (which may happen with older browsers). Simply list the languages in decreasing order of preference. For more information about content negotiation, please see the "Serving Document Based on Language Preference" section later in this chapter.

Note: Use of this directive requires that the mod_negotiation module be loaded. Please refer to the LoadModule directive explanation for more information.

The following is an example:

LanguagePriority en fr de

For more information, see the Apache Web Site Documentation on the LanguagePriority Directive:

The Redirect Directive
The Redirect directive is used to redirect absolute URL pathnames to absolute URL addresses. This is especially useful if you have resources that have moved from one location to another and want to "redirect" requests for the document at the old location to the new location.

The following is an example:

Redirect /path/file.html http://somewhere.else/file.html
Redirect /path/file.html http://www.yourcompany.com/newfile.html
Redirect /directory http://somewhere.else/directory/
Redirect /directory http://www.yourcompany.com/newdirectory/

For more information, see the Apache Web Site Documentation on the Redirect Directive:

The Alias Directive
The Alias directive allows documents to be stored in the local file system other than under the directory defined with the DocumentRoot directive.

The following is an example:

Alias icons /usr/local/etc/httpd/icons

For more information, see the Apache Web Site Documentation on the Alias Directive:

The ScriptAlias Directive
The ScriptAlias directive has the same behavior as the Alias directive, except that in addition to defining an alias definition, the directive also marks the target directory as containing CGI scripts.

The following is an example:

ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/

For more information, see the Apache Web Site Documentation on the ScriptAlias Directive:

The AddType Directive
The AddType directive allows you to add a new MIME type definition without editing the file defined by the TypesConfig directive. Your mime.types configuration file is fairly complete, so you will rarely need the AddType directive.

The following is an example:

AddType text/plain .txt

For more information, see the Apache Web Site Documentation on the AddType Directive:

The AddHandler Directive
The AddHandler directive maps a filename extension to a special handler.

Example:

# To use CGI scripts:
#AddHandler cgi-script .cgi

Or:

# To use server-parsed HTML files
AddType text/html .shtml
AddHandler server-parsed .shtml

For more information, see the Apache Web Site Documentation on AddHandler for Mod_Mime and the AddHandler Directive:

The ErrorDocument Directive
The ErrorDocument directive defines the location of documents that should be displayed (or scripts that should be invoked) when the server encounters an error. The directive can map the error codes to documents or scripts on your local server or on a remote server. When the error code is encountered, you web server instructs the browser client to redirect its request to the URL you define with the error code. If no ErrorDocument definition exists for a specific error code, then your web server outputs a hardcoded error message that it has defined internally. Common error codes include 401, 403, 404, 406, and 500. Those error codes and their definitions are found in the following table:

Error Code

Definition

Error Code 401 – Authorization Failed

The requested resource required authentication, and the client failed to provide a valid login/password pair.

Error Code 403 – Permission Denied

The client has requested a resource that is forbidden.

Error Code 404 – Resource Not Found

The requested resource does not exist on the web server.

Error Code 406 – Resource Not Acceptable

The requested resource was found on the web server, but it could not be delivered because the type of the resource is incompatible with accepted types indicated by the client.

Error Code 500 – Internal Error

The requested resource does not exist on the web server.

For more information about custom error handling, see "Creating Custom Error Document Pages" later in this chapter.

The following is an example:

ErrorDocument 401 /error_docs/subscribe.html
ErrorDocument 403 /error_docs/denied.html
ErrorDocument 404 /error_docs/notfound.html
ErrorDocument 406 /cgi-bin/error_scripts/language_handler.pl
ErrorDocument 500 /cgi-bin/error_scripts/script_error.pl

For more information, see Apache Web Site Documentation on ErrorDocument and Creating Custom Errors

Hosting  ::  Web Design  :: Server Administration  ::  Tech Support  ::  Contacts
Data Centers  ::  Tier I Global IP Network  ::  SLA/Contracts  ::  Search  ::  Account Login