1516N/A<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2935N/A <
title>Apache module mod_alias</
title>
2935N/A <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 2935N/A <
body bgcolor="#FFFFFF" text="#000000" link="#0000FF" 2935N/A vlink="#000080" alink="#FF0000">
2935N/A <
h1 align="CENTER">Module mod_alias</
h1>
2935N/A <
p>This module provides for mapping different parts of the host
2935N/A filesystem in the document tree, and for URL redirection.</
p>
2935N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1231N/A rel="Help"><
strong>Module Identifier:</
strong></
a>
3200N/A <
p>The directives contained in this module allow for
1231N/A manipulation and control of URLs as requests arrive at the
2935N/A server. The <
code>Alias</
code> and <
code>ScriptAlias</
code>
2935N/A directives are used to map between URLs and filesystem paths.
2935N/A This allows for content which is not directly under the <
a 2935N/A be served as part of the web document tree. The
1231N/A <
code>ScriptAlias</
code> directive has the additional effect of
1231N/A marking the target directory as containing only CGI
1580N/A <
p>The <
code>Redirect</
code> directives are used to instruct
1580N/A clients to make a new request with a different URL. They are
1580N/A often used when a resource has moved to a new location.</
p>
1580N/A <
p>A more powerful and flexible set of directives for
1580N/A manipulating URLs is contained in the <
a 1580N/A <
li><
a href="#alias">Alias</
a></
li>
1580N/A <
li><
a href="#aliasmatch">AliasMatch</
a></
li>
3200N/A <
li><
a href="#redirect">Redirect</
a></
li>
3200N/A <
li><
a href="#redirectmatch">RedirectMatch</
a></
li>
3200N/A <
li><
a href="#redirecttemp">RedirectTemp</
a></
li>
3200N/A <
li><
a href="#redirectperm">RedirectPermanent</
a></
li>
1580N/A <
li><
a href="#scriptalias">ScriptAlias</
a></
li>
1580N/A <
li><
a href="#scriptaliasmatch">ScriptAliasMatch</
a></
li>
3200N/A <
h2><
a id="alias" name="alias">Alias directive</
a></
h2>
3200N/A <
p>
<!--%plaintext <?INDEX {\tt Alias} directive> --> 1580N/A rel="Help"><
strong>Syntax:</
strong></
a> Alias <
em>URL-path
1580N/A file-path</
em>|<
em>directory-path</
em><
br />
1580N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1580N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1580N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1580N/A <
p>The Alias directive allows documents to be stored in the
1580N/A local filesystem other than under the <
a 3200N/A (%-decoded) path beginning with <
em>url-path</
em> will be
1580N/A mapped to local files beginning with
2935N/A <
em>directory-filename</
em>.</
p>
3352N/A <
p>Note that if you include a trailing / on the
2935N/A <
em>url-path</
em> then the server will require a trailing / in
2935N/A order to expand the alias. That is, if you use <
code>Alias
2935N/A <
code>/icons</
code> will not be aliased.</
p>
2935N/A <
p>Note that you may need to specify additional <
a 2935N/A sections which cover the <
em>destination</
em> of aliases.
1231N/A Aliasing occurs before <
code><Directory></
code> sections
1580N/A are checked, so only the destination of aliases are affected.
2236N/A sections are run through once before aliases are performed, so
2236N/A <
p>See also <
a href="#scriptalias">ScriptAlias</
a>.</
p>
2236N/A <
h2><
a id="aliasmatch" name="aliasmatch">AliasMatch</
a></
h2>
1231N/A rel="Help"><
strong>Syntax:</
strong></
a> AliasMatch <
em>regex
1231N/A file-path</
em>|<
em>directory-path</
em><
br />
1231N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1231N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1231N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1231N/A <
p>This directive is equivalent to <
a href="#alias">Alias</
a>,
2381N/A but makes use of standard regular expressions, instead of
1580N/A simple prefix matching. The supplied regular expression is
1231N/A matched against the URL-path, and if it matches, the server
2381N/A will substitute any parenthesized matches into the given string
1231N/A and use it as a filename. For example, to activate the
2236N/A <
code>/icons</
code> directory, one might use:</
p>
2935N/A <
h2><
a id="redirect" name="redirect">Redirect
2935N/A <
p>
<!--%plaintext <?INDEX {\tt Redirect} directive> --> 2935N/A rel="Help"><
strong>Syntax:</
strong></
a> Redirect
2935N/A [<
em>status</
em>] <
em>URL-path URL</
em><
br />
2935N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
2935N/A host, directory, .htaccess<
br />
2935N/A rel="Help"><
strong>Override:</
strong></
a> FileInfo<
br />
2236N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1231N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1231N/A <
p>The Redirect directive maps an old URL into a new one. The
1580N/A new URL is returned to the client which attempts to fetch it
1231N/A again with the new address. <
em>URL-path</
em> a (%-decoded)
1231N/A path; any requests for documents beginning with this path will
1231N/A be returned a redirect error to a new (%-encoded) URL beginning
1231N/A <
p><
strong>Note:</
strong> Redirect directives take precedence
1231N/A over Alias and ScriptAlias directives, irrespective of their
1231N/A ordering in the configuration file. Also, <
em>URL-path</
em>
1231N/A must be an absolute path, not a relative path, even when used
1580N/A with .htaccess files or inside of <Directory>
1580N/A <
p>If no <
em>status</
em> argument is given, the redirect will
1231N/A be "temporary" (HTTP status 302). This indicates to the client
1231N/A that the resource has moved temporarily. The <
em>status</
em>
1231N/A argument can be used to return other HTTP status codes:</
p>
2221N/A <
dd>Returns a permanent redirect status (301) indicating that
2221N/A the resource has moved permanently.</
dd>
1580N/A <
dd>Returns a temporary redirect status (302). This is the
1580N/A <
dd>Returns a "See Other" status (303) indicating that the
1580N/A resource has been replaced.</
dd>
1580N/A <
dd>Returns a "Gone" status (410) indicating that the
1580N/A resource has been permanently removed. When this status is
1580N/A used the <
em>url</
em> argument should be omitted.</
dd>
1580N/A <
p>Other status codes can be returned by giving the numeric
1580N/A status code as the value of <
em>status</
em>. If the status is
1580N/A between 300 and 399, the <
em>url</
em> argument must be present,
1580N/A otherwise it must be omitted. Note that the status must be
1580N/A known to the Apache code (see the function
1580N/A name="redirectmatch">RedirectMatch</
a></
h2>
1580N/A rel="Help"><
strong>Syntax:</
strong></
a> RedirectMatch
1580N/A [<
em>status</
em>] <
em>regex URL</
em><
br />
1580N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1580N/A host, directory, .htaccess<
br />
1580N/A rel="Help"><
strong>Override:</
strong></
a> FileInfo<
br />
1580N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1580N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1580N/A <
p>This directive is equivalent to <
a 1580N/A href="#redirect">Redirect</
a>, but makes use of standard
1580N/A regular expressions, instead of simple prefix matching. The
1580N/A supplied regular expression is matched against the URL-path,
1580N/A and if it matches, the server will substitute any parenthesized
1580N/A matches into the given string and use it as a filename. For
1580N/A example, to redirect all GIF files to like-named JPEG files on
1580N/A another server, one might use:</
p>
1580N/A <
h2><
a id="redirecttemp" name="redirecttemp">RedirectTemp
1580N/A <
p>
<!--%plaintext <?INDEX {\tt Redirect} directive> --> 2935N/A rel="Help"><
strong>Syntax:</
strong></
a> RedirectTemp
1580N/A <
em>URL-path URL</
em><
br />
1580N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1580N/A host, directory, .htaccess<
br />
1580N/A rel="Help"><
strong>Override:</
strong></
a> FileInfo<
br />
1580N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1580N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1580N/A <
p>This directive makes the client know that the Redirect is
1580N/A only temporary (status 302). Exactly equivalent to
1580N/A <
code>Redirect temp</
code>.</
p>
2381N/A <
h2><
a id="redirectperm" name="redirectperm">RedirectPermanent
2381N/A <
p>
<!--%plaintext <?INDEX {\tt Redirect} directive> --> 2381N/A rel="Help"><
strong>Syntax:</
strong></
a> RedirectPermanent
2381N/A <
em>URL-path URL</
em><
br />
1580N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1580N/A host, directory, .htaccess<
br />
1580N/A rel="Help"><
strong>Override:</
strong></
a> FileInfo<
br />
1580N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
2221N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
2221N/A <
p>This directive makes the client know that the Redirect is
2221N/A permanent (status 301). Exactly equivalent to <
code>Redirect
2221N/A <
h2><
a id="scriptalias" name="scriptalias">ScriptAlias
2221N/A <!--%plaintext <?INDEX {\tt ScriptAlias} directive> --> 2221N/A rel="Help"><
strong>Syntax:</
strong></
a> ScriptAlias
1580N/A <
em>URL-path file-path</
em>|<
em>directory-path</
em><
br />
2236N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1580N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1580N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1580N/A <
p>The ScriptAlias directive has the same behavior as the <
a 1580N/A href="#alias">Alias</
a> directive, except that in addition it
1580N/A marks the target directory as containing CGI scripts. URLs with
1580N/A a (%-decoded) path beginning with <
em>URL-path</
em> will be
1580N/A mapped to scripts beginning with the second argument which is a
1580N/A full pathname in the local filesystem.</
p>
1580N/A <
h2><
a id="scriptaliasmatch" 1580N/A name="scriptaliasmatch">ScriptAliasMatch</
a></
h2>
1580N/A rel="Help"><
strong>Syntax:</
strong></
a> ScriptAliasMatch
1580N/A <
em>regex file-path</
em>|<
em>directory-path</
em><
br />
1580N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
1580N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1580N/A rel="Help"><
strong>Module:</
strong></
a> mod_alias</
p>
1580N/A <
p>This directive is equivalent to <
a 1580N/A href="#scriptalias">ScriptAlias</
a>, but makes use of standard
1580N/A regular expressions, instead of simple prefix matching. The
1580N/A supplied regular expression is matched against the URL-path,
1580N/A and if it matches, the server will substitute any parenthesized
2236N/A matches into the given string and use it as a filename. For
1580N/A example, to activate the standard <
code>/cgi-bin</
code>, one