893N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
893N/A<
TITLE>Apache module mod_alias</
TITLE>
2362N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 893N/A<
H1 ALIGN="CENTER">Module mod_alias</
H1>
893N/Ais compiled in by default. It provides for mapping different parts of the
2362N/Ahost filesystem in the the document tree, and for URL redirection.
893N/A<
LI><
A HREF="#alias">Alias</
A>
893N/A<
LI><
A HREF="#aliasmatch">AliasMatch</
A>
893N/A<
LI><
A HREF="#redirect">Redirect</
A>
893N/A<
LI><
A HREF="#redirectmatch">RedirectMatch</
A>
893N/A<
LI><
A HREF="#redirecttemp">RedirectTemp</
A>
893N/A<
LI><
A HREF="#redirectperm">RedirectPermanent</
A>
893N/A<
LI><
A HREF="#scriptalias">ScriptAlias</
A>
893N/A<
LI><
A HREF="#scriptaliasmatch">ScriptAliasMatch</
A>
1580N/A<
h2><
A name="alias">Alias directive</
A></
h2>
893N/A<!--%plaintext <?INDEX {\tt Alias} directive> --> 893N/A><
STRONG>Syntax:</
STRONG></
A> Alias <
EM>url-path directory-filename</
EM><
BR>
893N/A><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
1580N/A><
STRONG>Status:</
STRONG></
A> Base<
BR>
893N/A><
STRONG>Module:</
STRONG></
A> mod_alias
893N/AThe Alias directive allows documents to be stored in the local filesystem
893N/Aother than under the <
A HREF="core.html#documentroot">DocumentRoot</
A>.
893N/AURLs with a (%-decoded) path beginning with <
EM>url-path</
EM> will be
893N/Amapped to local files beginning with <
EM>directory-filename</
EM>.
1580N/ANote that if you include a trailing / on the <
EM>url-path</
EM> then the
1580N/Aserver will require a trailing / in order to expand the alias. That is,
1580N/Athe url <
CODE>/icons</
CODE> will not be aliased.
1580N/ASee also <
A HREF="#scriptalias">ScriptAlias</
A>.
893N/A<
h2><
A name="aliasmatch">AliasMatch</
A></
h2>
1580N/A><
STRONG>Syntax:</
STRONG></
A> AliasMatch <
EM>regex directory-filename</
EM><
BR>
1580N/A><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
893N/A><
STRONG>Status:</
STRONG></
A> Base<
BR>
893N/A><
STRONG>Module:</
STRONG></
A> mod_alias<
BR>
893N/A><
STRONG>Compatibility:</
STRONG></
A> Available in Apache 1.3 and later
1580N/A<
P>This directive is equivalent to <
A HREF="#alias">Alias</
A>, but
893N/Amakes use of standard regular expressions, instead of simple prefix
893N/Amatching. The supplied regular expression is matched against the URL,
893N/Aand if it matches, the server will substitute any parenthesized
893N/Amatches into the given string and use it as a filename. For example,
893N/Ato activate the <
CODE>/icons</
CODE> directory, one might use:
<
h2><
A name="redirect">Redirect directive</
A></
h2>
<!--%plaintext <?INDEX {\tt Redirect} directive> --> ><
STRONG>Syntax:</
STRONG></
A> Redirect [ <
EM>status</
EM> ] <
EM>url-path url</
EM><
BR>
><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory, .htaccess<
BR>
><
STRONG>Status:</
STRONG></
A> Base<
BR>
><
STRONG>Module:</
STRONG></
A> mod_alias<
BR>
><
STRONG>Compatibility:</
STRONG></
A> The directory and .htaccess context's
are only available in versions 1.1 and later. The <
EM>status</
EM>
argument is only available in Apache 1.2 or 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.
<
EM>Url-path</
EM> a (%-decoded) path; any requests for documents beginning with
this path will be returned a redirect error to a new (%-encoded) url
beginning with <
EM>url</
EM>.
<
BLOCKQUOTE><
CODE>Redirect /service
<
STRONG>Note:</
STRONG> Redirect directives take precedence over Alias
directives, irrespective of their ordering in the configuration file. Also,
<
EM>Url-path</
EM> must be an absolute path, not a relative path, even
when used with .htaccess files or inside of <Directory> sections.
If no <
EM>status</
EM> argument is given, the redirect will be
"temporary" (HTTP status 302). This indicates to the client that the
resources is has moved temporarily. The <
EM>status</
EM>
argument can be used to return other HTTP status codes:
<
DD>Returns a permanent redirect status (301) indicating that
the resource has moved permanently.
<
DD>Returns a temporary redirect status (302). This is the
<
DD>Returns a "See Other" status (303) indicating that
the resource has been replaced.
<
DD>Returns a "Gone" status (410) indicating that the resource
has been permanently removed. When this status is used the <
EM>url</
EM>
argument should be omitted.
Other status codes can be returned by giving the numeric status code
as the value of <
EM>status</
EM>. If the status is between 300 and 399,
the <
EM>url</
EM> argument must be present, otherwise it must be
omitted. Note that the status must be known to the Apache code (see
<
h2><
A name="redirectmatch">RedirectMatch</
A></
h2>
><
STRONG>Syntax:</
STRONG></
A> RedirectMatch [<
EM>status</
EM> <
EM>regex url</
EM><
BR>
><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
><
STRONG>Status:</
STRONG></
A> Base<
BR>
><
STRONG>Module:</
STRONG></
A> mod_alias<
BR>
><
STRONG>Compatibility:</
STRONG></
A> Available in Apache 1.3 and later
<
P>This directive is equivalent to <
A HREF="#alias">Redirect</
A>, but
makes use of standard regular expressions, instead of simple prefix
matching. The supplied regular expression is matched against the URL,
and if it matches, the server will substitute any parenthesized
matches into the given string and use it as a filename. For example,
to redirect all GIF files to like-named JPEG files on another server,
<
h2><
A name="redirecttemp">RedirectTemp directive</
A></
h2>
<!--%plaintext <?INDEX {\tt Redirect} directive> --> ><
STRONG>Syntax:</
STRONG></
A> RedirectTemp <
EM>url-path url</
EM><
BR>
><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory, .htaccess<
BR>
><
STRONG>Status:</
STRONG></
A> Base<
BR>
><
STRONG>Module:</
STRONG></
A> mod_alias<
BR>
><
STRONG>Compatibility:</
STRONG></
A> This directive is only available in 1.2
This directive makes the client know that the Redirect is only
temporary (status 302). Exactly equivalent to <
CODE>Redirect
<
h2><
A name="redirectperm">RedirectPermanent directive</
A></
h2>
<!--%plaintext <?INDEX {\tt Redirect} directive> --> ><
STRONG>Syntax:</
STRONG></
A> RedirectPermanent <
EM>url-path url</
EM><
BR>
><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory, .htaccess<
BR>
><
STRONG>Status:</
STRONG></
A> Base<
BR>
><
STRONG>Module:</
STRONG></
A> mod_alias<
BR>
><
STRONG>Compatibility:</
STRONG></
A> This directive is only available in 1.2
This directive makes the client know that the Redirect is permanent
(status 301). Exactly equivalent to <
CODE>Redirect permanent</
CODE>.
<
h2><
A name="scriptalias">ScriptAlias directive</
A></
h2>
<!--%plaintext <?INDEX {\tt ScriptAlias} directive> --> ><
STRONG>Syntax:</
STRONG></
A> ScriptAlias <
EM>url-path directory-filename</
EM><
BR>
><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
><
STRONG>Status:</
STRONG></
A> Base<
BR>
><
STRONG>Module:</
STRONG></
A> mod_alias
The ScriptAlias directive has the same behavior as the
<
A HREF="#alias">Alias</
A> directive, except that in addition it
marks the target directory as containing CGI scripts.
URLs with a (%-decoded) path beginning with <
EM>url-path</
EM> will be
mapped to scripts beginning with <
EM>directory-filename</
EM>.
<
BLOCKQUOTE><
CODE>ScriptAlias /cgi-bin/ /
web/
cgi-bin/</
CODE></
BLOCKQUOTE>
<
h2><
A name="scriptaliasmatch">ScriptAliasMatch</
A></
h2>
><
STRONG>Syntax:</
STRONG></
A> ScriptAliasMatch <
EM>regex directory-filename</
EM><
BR>
><
STRONG>Context:</
STRONG></
A> server config, virtual host<
BR>
><
STRONG>Status:</
STRONG></
A> Base<
BR>
><
STRONG>Module:</
STRONG></
A> mod_alias<
BR>
><
STRONG>Compatibility:</
STRONG></
A> Available in Apache 1.3 and later
<
P>This directive is equivalent to <
A HREF="#scriptalias">ScriptAlias</
A>, but
makes use of standard regular expressions, instead of simple prefix
matching. The supplied regular expression is matched against the URL,
and if it matches, the server will substitute any parenthesized
matches into the given string and use it as a filename. For example,
to activate the standard <
CODE>/cgi-bin</
CODE>, one might use: