mod_alias.xml revision 2348633f2de9e8a3228db792f189d8b6ffdfdafa
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<?xml version="1.0"?>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<modulesynopsis>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<name>mod_alias</name>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<description>Provides for mapping different parts of the host
5a58787efeb02a1c3f06569d019ad81fd2efa06end filesystem in the document tree and for URL redirection</description>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<status>Base</status>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<sourcefile>mod_alias.c</sourcefile>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<identifier>alias_module</identifier>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
00c2cccc28f249fb3b968ddf3e05508595290d40nd<summary>
5a58787efeb02a1c3f06569d019ad81fd2efa06end <p>The directives contained in this module allow for manipulation
5a58787efeb02a1c3f06569d019ad81fd2efa06end and control of URLs as requests arrive at the server. The
5a58787efeb02a1c3f06569d019ad81fd2efa06end <directive module="mod_alias">Alias</directive> and <directive
5a58787efeb02a1c3f06569d019ad81fd2efa06end module="mod_alias">ScriptAlias</directive> directives are used to
5a58787efeb02a1c3f06569d019ad81fd2efa06end map between URLs and filesystem paths. This allows for content
5a58787efeb02a1c3f06569d019ad81fd2efa06end which is not directly under the <directive
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd module="core">DocumentRoot</directive> served as part of the web
a78048ccbdb6256da15e6b0e7e95355e480c2301nd document tree. The <directive
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd module="mod_alias">ScriptAlias</directive> directive has the
a78048ccbdb6256da15e6b0e7e95355e480c2301nd additional effect of marking the target directory as containing
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd only CGI scripts.</p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <p>The <directive module="mod_alias">Redirect</directive>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive directives are used to instruct clients to make a new request with
5a58787efeb02a1c3f06569d019ad81fd2efa06end a different URL. They are often used when a resource has moved to
5a58787efeb02a1c3f06569d019ad81fd2efa06end a new location.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end</summary>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<seealso><module>mod_rewrite</module></seealso> <seealso><a
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slivehref="/urlmapping.html">Mapping URLs to the filesystem</a></seealso>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<directivesynopsis>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<name>Alias</name>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<description>Maps URLs to filesystem locations</description>
9bcfc3697a91b5215893a7d0206865b13fc72148nd<syntax>Alias <var>URL-path</var>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<var>file-path</var>|<var>directory-path</var></syntax>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<contextlist><context>server config</context><context>virtual host</context>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive</contextlist>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive<usage>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <p>The <directive>Alias</directive> directive allows documents to
9bcfc3697a91b5215893a7d0206865b13fc72148nd be stored in the local filesystem other than under the
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <directive module="core">DocumentRoot</directive>. URLs with a
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive (%-decoded) path beginning with <var>url-path</var> will be mapped
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive to local files beginning with <var>directory-path</var>.</p>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
9ed703ab1543b3300f4b60c0405fc1a212b601c8slive <example><title>Example:</title>
9ed703ab1543b3300f4b60c0405fc1a212b601c8slive Alias /image /ftp/pub/image
9ed703ab1543b3300f4b60c0405fc1a212b601c8slive </example>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <p>A request for http://myserver/image/foo.gif would cause the
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive server to return the file /ftp/pub/image/foo.gif.</p>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <p>Note that if you include a trailing / on the
9bcfc3697a91b5215893a7d0206865b13fc72148nd <var>url-path</var> then the server will require a trailing / in
a8703cfb67133446eef7af1043640e71486e9ecand order to expand the alias. That is, if you use <code>Alias
a8703cfb67133446eef7af1043640e71486e9ecand /icons/ /usr/local/apache/icons/</code> then the url
9bcfc3697a91b5215893a7d0206865b13fc72148nd <code>/icons</code> will not be aliased.</p>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <p>Note that you may need to specify additional <directive
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive type="section" module="core">Directory</directive> sections which
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive cover the <em>destination</em> of aliases. Aliasing occurs before
9bcfc3697a91b5215893a7d0206865b13fc72148nd <directive type="section" module="core">Directory</directive> sections
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive are checked, so only the destination of aliases are affected.
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive (Note however <directive type="section" module="core">Location</directive>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive sections are run through once before aliases are performed, so
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive they will apply.)</p>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <p>In particular, if you are creating an <code>Alias</code> to a
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive directory outside of your <directive
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive module="code">DocumentRoot</directive>, you may need to explicitly
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive permit access to the target directory.</p>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive <example><title>Example:</title>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive Alias /image /ftp/pub/image<br />
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive &lt;Directory /ftp/pub/image&gt;<br />
9bcfc3697a91b5215893a7d0206865b13fc72148nd <indent>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive Order allow,deny<br />
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive Allow from all<br />
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive </indent>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive &lt;/Directory&gt;
fe3e19e712f4f977166c1ca02b5ee6435c12df8fnd </example>
f78ba66d5075af3e07e2d93aa7fa7b884836c6e8slive
5a58787efeb02a1c3f06569d019ad81fd2efa06end</usage>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</directivesynopsis>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd<directivesynopsis>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<name>AliasMatch</name>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<description>Maps URLs to filesystem locations using regular
35714556a25fceb7c9bf9c4e01791b2e2a4c27c3ndexpressions</description>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<syntax>AliasMatch <var>regex</var>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<var>file-path</var>|<var>directory-path</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<usage>
<p>This directive is equivalent to <directive
module="mod_alias">Alias</directive>, but makes use of standard
regular expressions, instead of simple prefix matching. The
supplied regular expression is matched against the URL-path, 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 <code>/icons</code> directory, one might
use:</p>
<example>
AliasMatch ^/icons(.*) /usr/local/apache/icons$1
</example>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>Redirect</name>
<description>Sends an external redirect asking the client to fetch
a different URL</description>
<syntax>Redirect [<var>status</var>] <var>URL-path</var>
<var>URL</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>
<usage>
<p>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. <var>URL-path</var> a (%-decoded)
path; any requests for documents beginning with this path will
be returned a redirect error to a new (%-encoded) URL beginning
with <var>URL</var>.</p>
<example><title>Example:</title>
Redirect /service http://foo2.bar.com/service
</example>
<p>If the client requests http://myserver/service/foo.txt, it
will be told to access http://foo2.bar.com/service/foo.txt
instead.</p>
<note><title>Note</title> <p>Redirect directives take precedence over
Alias and ScriptAlias directives, irrespective of their ordering in
the configuration file. Also, <var>URL-path</var> must be an absolute
path, not a relative path, even when used with .htaccess files or
inside of <directive type="section" module="core">Directory</directive>
sections.</p></note>
<p>If no <var>status</var> argument is given, the redirect will
be "temporary" (HTTP status 302). This indicates to the client
that the resource has moved temporarily. The <var>status</var>
argument can be used to return other HTTP status codes:</p>
<dl>
<dt>permanent</dt>
<dd>Returns a permanent redirect status (301) indicating that
the resource has moved permanently.</dd>
<dt>temp</dt>
<dd>Returns a temporary redirect status (302). This is the
default.</dd>
<dt>seeother</dt>
<dd>Returns a "See Other" status (303) indicating that the
resource has been replaced.</dd>
<dt>gone</dt>
<dd>Returns a "Gone" status (410) indicating that the
resource has been permanently removed. When this status is
used the <var>URL</var> argument should be omitted.</dd>
</dl>
<p>Other status codes can be returned by giving the numeric
status code as the value of <var>status</var>. If the status is
between 300 and 399, the <var>URL</var> argument must be present,
otherwise it must be omitted. Note that the status must be
known to the Apache code (see the function
<code>send_error_response</code> in http_protocol.c).</p>
<example><title>Example:</title>
Redirect permanent /one http://example.com/two<br />
Redirect 303 /three http://example.com/other
</example>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>RedirectMatch</name>
<description>Sends an external redirect based on a regular expression match
of the current URL</description>
<syntax>RedirectMatch [<var>status</var>] <var>regex</var>
<var>URL</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>
<usage>
<p>This directive is equivalent to <directive
module="mod_alias">Redirect</directive>, but makes use of standard
regular expressions, instead of simple prefix matching. The
supplied regular expression is matched against the URL-path, 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, one might use:</p>
<example>
RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg
</example>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>RedirectTemp</name>
<description>Sends an external temporary redirect asking the client to fetch
a different URL</description>
<syntax>RedirectTemp <var>URL-path</var> <var>URL</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>
<usage>
<p>This directive makes the client know that the Redirect is
only temporary (status 302). Exactly equivalent to
<code>Redirect temp</code>.</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>RedirectPermanent</name>
<description>Sends an external permanent redirect asking the client to fetch
a different URL</description>
<syntax>RedirectPermanent <var>URL-path</var> <var>URL</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>FileInfo</override>
<usage>
<p>This directive makes the client know that the Redirect is
permanent (status 301). Exactly equivalent to <code>Redirect
permanent</code>.</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ScriptAlias</name>
<description>Maps a URL to a filesystem location and designates the
target as a CGI script</description>
<syntax>ScriptAlias <var>URL-path</var>
<var>file-path</var>|<var>directory-path</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<usage>
<p>The <directive>ScriptAlias</directive> directive has the same
behavior as the <directive module="mod_alias">Alias</directive>
directive, except that in addition it marks the target directory
as containing CGI scripts that will be processed by <module
>mod_cgi</module>'s cgi-script handler. URLs with a
(%-decoded) path beginning with <var>URL-path</var> will be mapped
to scripts beginning with the second argument which is a full
pathname in the local filesystem.</p>
<example><title>Example:</title>
ScriptAlias /cgi-bin/ /web/cgi-bin/
</example>
<p>A request for <code>http://myserver/cgi-bin/foo</code> would cause the
server to run the script <code>/web/cgi-bin/foo</code>.</p>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>ScriptAliasMatch</name>
<description>Maps a URL to a filesystem location using a regular expression
and designates the target as a CGI script</description>
<syntax>ScriptAliasMatch <var>regex</var>
<var>file-path</var>|<var>directory-path</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<usage>
<p>This directive is equivalent to <directive module="mod_alias"
>ScriptAlias</directive>, but makes use of standard
regular expressions, instead of simple prefix matching. The
supplied regular expression is matched against the URL-path,
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:</p>
<example>
ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1
</example>
</usage>
</directivesynopsis>
</modulesynopsis>