mod_alias.xml revision 04c83c4f6de6e7b087addba0377d998d2394699a
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<?xml version="1.0"?>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<!--
b062c76dff08accbdae415e6fed10ad6696b5a80takashi Copyright 2002-2004 The Apache Software Foundation
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi Licensed under the Apache License, Version 2.0 (the "License");
b062c76dff08accbdae415e6fed10ad6696b5a80takashi you may not use this file except in compliance with the License.
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc You may obtain a copy of the License at
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi http://www.apache.org/licenses/LICENSE-2.0
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
2e545ce2450a9953665f701bb05350f0d3f26275nd Unless required by applicable law or agreed to in writing, software
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen distributed under the License is distributed on an "AS IS" BASIS,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b062c76dff08accbdae415e6fed10ad6696b5a80takashi See the License for the specific language governing permissions and
b062c76dff08accbdae415e6fed10ad6696b5a80takashi limitations under the License.
b062c76dff08accbdae415e6fed10ad6696b5a80takashi-->
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<modulesynopsis metafile="mod_alias.xml.meta">
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<name>mod_alias</name>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<description>Provides for mapping different parts of the host
b43f840409794ed298e8634f6284741f193b6c4ftakashi filesystem in the document tree and for URL redirection</description>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<status>Base</status>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<sourcefile>mod_alias.c</sourcefile>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<identifier>alias_module</identifier>
b43f840409794ed298e8634f6284741f193b6c4ftakashi
11495c9f0bd33e51a25b4d532beadfbcf9b944a3nilgun<summary>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>The directives contained in this module allow for manipulation
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung and control of URLs as requests arrive at the server. The
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <directive module="mod_alias">Alias</directive> and <directive
b062c76dff08accbdae415e6fed10ad6696b5a80takashi module="mod_alias">ScriptAlias</directive> directives are used to
b062c76dff08accbdae415e6fed10ad6696b5a80takashi map between URLs and filesystem paths. This allows for content
b062c76dff08accbdae415e6fed10ad6696b5a80takashi which is not directly under the <directive
6a3ab831a34f470b077294a173f24fcf1e5f0a3ctakashi module="core">DocumentRoot</directive> served as part of the web
b062c76dff08accbdae415e6fed10ad6696b5a80takashi document tree. The <directive
b062c76dff08accbdae415e6fed10ad6696b5a80takashi module="mod_alias">ScriptAlias</directive> directive has the
b062c76dff08accbdae415e6fed10ad6696b5a80takashi additional effect of marking the target directory as containing
b062c76dff08accbdae415e6fed10ad6696b5a80takashi only CGI scripts.</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>The <directive module="mod_alias">Redirect</directive>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi directives are used to instruct clients to make a new request with
b062c76dff08accbdae415e6fed10ad6696b5a80takashi a different URL. They are often used when a resource has moved to
b062c76dff08accbdae415e6fed10ad6696b5a80takashi a new location.</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi</summary>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<seealso><module>mod_rewrite</module></seealso> <seealso><a
b062c76dff08accbdae415e6fed10ad6696b5a80takashihref="/urlmapping.html">Mapping URLs to the filesystem</a></seealso>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<directivesynopsis>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<name>Alias</name>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<description>Maps URLs to filesystem locations</description>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<syntax>Alias <var>URL-path</var>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<var>file-path</var>|<var>directory-path</var></syntax>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<contextlist><context>server config</context><context>virtual host</context>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi</contextlist>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi<usage>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>The <directive>Alias</directive> directive allows documents to
b062c76dff08accbdae415e6fed10ad6696b5a80takashi be stored in the local filesystem other than under the
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <directive module="core">DocumentRoot</directive>. URLs with a
b062c76dff08accbdae415e6fed10ad6696b5a80takashi (%-decoded) path beginning with <var>url-path</var> will be mapped
b062c76dff08accbdae415e6fed10ad6696b5a80takashi to local files beginning with <var>directory-path</var>.</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <example><title>Example:</title>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi Alias /image /ftp/pub/image
b062c76dff08accbdae415e6fed10ad6696b5a80takashi </example>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>A request for http://myserver/image/foo.gif would cause the
b062c76dff08accbdae415e6fed10ad6696b5a80takashi server to return the file /ftp/pub/image/foo.gif.</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>Note that if you include a trailing / on the
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <var>url-path</var> then the server will require a trailing / in
b062c76dff08accbdae415e6fed10ad6696b5a80takashi order to expand the alias. That is, if you use <code>Alias
b062c76dff08accbdae415e6fed10ad6696b5a80takashi /icons/ /usr/local/apache/icons/</code> then the url
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <code>/icons</code> will not be aliased.</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>Note that you may need to specify additional <directive
b062c76dff08accbdae415e6fed10ad6696b5a80takashi type="section" module="core">Directory</directive> sections which
b062c76dff08accbdae415e6fed10ad6696b5a80takashi cover the <em>destination</em> of aliases. Aliasing occurs before
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <directive type="section" module="core">Directory</directive> sections
b062c76dff08accbdae415e6fed10ad6696b5a80takashi are checked, so only the destination of aliases are affected.
b062c76dff08accbdae415e6fed10ad6696b5a80takashi (Note however <directive type="section" module="core">Location</directive>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi sections are run through once before aliases are performed, so
b062c76dff08accbdae415e6fed10ad6696b5a80takashi they will apply.)</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <p>In particular, if you are creating an <code>Alias</code> to a
b062c76dff08accbdae415e6fed10ad6696b5a80takashi directory outside of your <directive
b062c76dff08accbdae415e6fed10ad6696b5a80takashi module="core">DocumentRoot</directive>, you may need to explicitly
b062c76dff08accbdae415e6fed10ad6696b5a80takashi permit access to the target directory.</p>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <example><title>Example:</title>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi Alias /image /ftp/pub/image<br />
b062c76dff08accbdae415e6fed10ad6696b5a80takashi &lt;Directory /ftp/pub/image&gt;<br />
b062c76dff08accbdae415e6fed10ad6696b5a80takashi <indent>
b062c76dff08accbdae415e6fed10ad6696b5a80takashi Order allow,deny<br />
b062c76dff08accbdae415e6fed10ad6696b5a80takashi Allow from all<br />
b43f840409794ed298e8634f6284741f193b6c4ftakashi </indent>
11495c9f0bd33e51a25b4d532beadfbcf9b944a3nilgun &lt;/Directory&gt;
b062c76dff08accbdae415e6fed10ad6696b5a80takashi </example>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung
727872d18412fc021f03969b8641810d8896820bhumbedooh</usage>
0d0ba3a410038e179b695446bb149cce6264e0abnd</directivesynopsis>
727872d18412fc021f03969b8641810d8896820bhumbedooh
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh<directivesynopsis>
0d0ba3a410038e179b695446bb149cce6264e0abnd<name>AliasMatch</name>
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh<description>Maps URLs to filesystem locations using regular
727872d18412fc021f03969b8641810d8896820bhumbedoohexpressions</description>
0d0ba3a410038e179b695446bb149cce6264e0abnd<syntax>AliasMatch <var>regex</var>
0d0ba3a410038e179b695446bb149cce6264e0abnd<var>file-path</var>|<var>directory-path</var></syntax>
0d0ba3a410038e179b695446bb149cce6264e0abnd<contextlist><context>server config</context><context>virtual host</context>
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh</contextlist>
0d0ba3a410038e179b695446bb149cce6264e0abnd
0d0ba3a410038e179b695446bb149cce6264e0abnd<usage>
0d0ba3a410038e179b695446bb149cce6264e0abnd <p>This directive is equivalent to <directive
727872d18412fc021f03969b8641810d8896820bhumbedooh module="mod_alias">Alias</directive>, but makes use of standard
0d0ba3a410038e179b695446bb149cce6264e0abnd regular expressions, instead of simple prefix matching. The
0d0ba3a410038e179b695446bb149cce6264e0abnd supplied regular expression is matched against the URL-path, and
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh if it matches, the server will substitute any parenthesized
205f749042ed530040a4f0080dbcb47ceae8a374rjung matches into the given string and use it as a filename. For
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen example, to activate the <code>/icons</code> directory, one might
0d0ba3a410038e179b695446bb149cce6264e0abnd use:</p>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <example>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd AliasMatch ^/icons(.*) /usr/local/apache/icons$1
b062c76dff08accbdae415e6fed10ad6696b5a80takashi </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 a fully
qualified URL, 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>