# Module mod_alias

This module is contained in the `mod_alias.c` file, and is compiled in by default. It provides for mapping different parts of the host filesystem in the the document tree, and for URL redirection.
- Alias
- Redirect
- ScriptAlias

## Alias

Syntax: Alias url-path directory-filename
Context: server config, virtual host
Status: Base
Module: mod_alias
Compatibility: Alias is only available in Apache 1.1 and later

The Alias directive allows documents to be stored in the local filesystem other than under the DocumentRoot. URLs with a (%-decoded) path beginning with url-path will be mapped to local files beginning with directory-filename. Example:

> `Alias /image /ftp/pub/image`

A request for http://myserver/image/foo.gif would cause the server to return the file /ftp/pub/image/foo.gif.

See also ScriptAlias.

## Redirect

Syntax: Redirect url-path url
Context: server config, virtual host, directory, .htaccess
Status: Base
Module: mod_alias
Compatibility: The directory and .htaccess context's are only available in versions 1.1 and later

The Redirect directive maps an old URL into a new one. The new URL is returned to the client which attempts to fetch it again with the new address. Url-path a (%-decoded) path; any requests for documents beginning with this path will be returned a redirect error to a new (%-encoded) url beginning with url. Example:

> `Redirect /service http://foo2.bar.com/service`

If the client requests http://myserver/service/foo.txt, it will be told to access http://foo2.bar.com/service/foo.txt instead.

Note: Redirect directives take precedence over Alias and ScriptAlias directives, irrespective of their ordering in the configuration file.

## ScriptAlias

Syntax: ScriptAlias url-path directory-filename
Context: server config, virtual host
Status: Base
Module: mod_alias
Compatibility: ScriptAlias is only available in Apache 1.1 and later

The ScriptAlias directive has the same behaviour as the Alias directive, except that in addition it marks the target directory as containing CGI scripts. URLs with a (%-decoded) path beginning with url-path will be mapped to scripts beginning with directory-filename. Example:

> `ScriptAlias /cgi-bin/ /web/cgi-bin/`

A request for http://myserver/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo.