mirror of
https://github.com/apache/httpd.git
synced 2025-06-04 21:42:15 +03:00
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96655 13f79535-47bb-0310-9956-ffa450edef68
231 lines
22 KiB
XML
231 lines
22 KiB
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
|
||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||
This file is generated from xml source: DO NOT EDIT
|
||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||
--><title>mod_alias - Apache HTTP Server</title><link href="../style/css/manual-sbar-right-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - blue (font 100%)" /><link href="../style/css/manual-sbar-right-90pc.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - blue (font 90%)" /><link href="../style/css/manual-sbar-right-fix15.css" rel="stylesheet" media="all" type="text/css" title="right sidebar - blue (font fix 15)" /><link href="../style/css/manual-sbar-right-fix13.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - blue (font fix 13)" /><link href="../style/css/manual-sbar-right-100pc-b.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - black (font 100%)" /><link href="../style/css/manual-sbar-right-90pc-b.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - black (font 90%)" /><link href="../style/css/manual-sbar-right-fix15-b.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - black (font fix 15)" /><link href="../style/css/manual-sbar-right-fix13-b.css" rel="alternate stylesheet" media="all" type="text/css" title="right sidebar - black (font fix 13)" /><link href="../style/css/manual-sbar-left-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - blue (font 100%)" /><link href="../style/css/manual-sbar-left-90pc.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - blue (font 90%)" /><link href="../style/css/manual-sbar-left-fix15.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - blue (font fix 15)" /><link href="../style/css/manual-sbar-left-fix13.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - blue (font fix 13)" /><link href="../style/css/manual-sbar-left-100pc-b.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - black (font 100%)" /><link href="../style/css/manual-sbar-left-90pc-b.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - black (font 90%)" /><link href="../style/css/manual-sbar-left-fix15-b.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - black (font fix 15)" /><link href="../style/css/manual-sbar-left-fix13-b.css" rel="alternate stylesheet" media="all" type="text/css" title="left sidebar - black (font fix 13)" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - blue (font 100%)" /><link href="../style/css/manual-loose-90pc.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - blue (font 90%)" /><link href="../style/css/manual-loose-fix15.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - blue (font fix 15)" /><link href="../style/css/manual-loose-fix13.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - blue (font fix 13)" /><link href="../style/css/manual-loose-100pc-b.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - black (font 100%)" /><link href="../style/css/manual-loose-90pc-b.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - black (font 90%)" /><link href="../style/css/manual-loose-fix15-b.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - black (font fix 15)" /><link href="../style/css/manual-loose-fix13-b.css" rel="alternate stylesheet" media="all" type="text/css" title="loose style - black (font fix 13)" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body><div id="page-header"><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div><div id="page-content"><div id="preamble"><h1>Apache Module mod_alias</h1><table class="module"><tr><th>Description:
|
||
</th><td>Provides for mapping different parts of the host
|
||
filesystem in the document tree and for URL redirection</td></tr><tr><th><a href="module-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="module-dict.html#ModuleIdentifier">Module<EFBFBD>Identifier:
|
||
</a></th><td>alias_module</td></tr></table><h3>Summary</h3>
|
||
<p>The directives contained in this module allow for manipulation
|
||
and control of URLs as requests arrive at the server. The
|
||
<code class="directive"><a href="#alias">Alias</a></code> and <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> directives are used to
|
||
map between URLs and filesystem paths. This allows for content
|
||
which is not directly under the <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> served as part of the web
|
||
document tree. The <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> directive has the
|
||
additional effect of marking the target directory as containing
|
||
only CGI scripts.</p>
|
||
|
||
<p>The <code class="directive"><a href="#redirect">Redirect</a></code>
|
||
directives are used to instruct clients to make a new request with
|
||
a different URL. They are often used when a resource has moved to
|
||
a new location.</p>
|
||
</div><div id="quickview"><h3 class="directives">Directives</h3><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#alias">Alias</a></li><li><img alt="" src="../images/down.gif" /> <a href="#aliasmatch">AliasMatch</a></li><li><img alt="" src="../images/down.gif" /> <a href="#redirect">Redirect</a></li><li><img alt="" src="../images/down.gif" /> <a href="#redirectmatch">RedirectMatch</a></li><li><img alt="" src="../images/down.gif" /> <a href="#redirectpermanent">RedirectPermanent</a></li><li><img alt="" src="../images/down.gif" /> <a href="#redirecttemp">RedirectTemp</a></li><li><img alt="" src="../images/down.gif" /> <a href="#scriptalias">ScriptAlias</a></li><li><img alt="" src="../images/down.gif" /> <a href="#scriptaliasmatch">ScriptAliasMatch</a></li></ul><h3>See also</h3><ul class="seealso"><li><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></li><li><a href="../urlmapping.html">Mapping URLs to the filesystem</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="Alias" id="Alias">Alias</a> <a name="alias" id="alias">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Maps URLs to filesystem locations</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td> Alias <em>URL-path
|
||
file-path</em>|<em>directory-path</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
|
||
<p>The <code class="directive">Alias</code> directive allows documents to
|
||
be stored in the local filesystem other than under the
|
||
<code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>. URLs with a
|
||
(%-decoded) path beginning with <em>url-path</em> will be mapped
|
||
to local files beginning with <em>directory-filename</em>.</p>
|
||
|
||
<p>Example:</p>
|
||
|
||
<div class="example"><p><code>Alias /image /ftp/pub/image</code></p></div>
|
||
|
||
<p>A request for http://myserver/image/foo.gif would cause the
|
||
server to return the file /ftp/pub/image/foo.gif.</p>
|
||
|
||
<p>Note that if you include a trailing / on the
|
||
<em>url-path</em> then the server will require a trailing / in
|
||
order to expand the alias. That is, if you use <code>Alias
|
||
/icons/ /usr/local/apache/icons/</code> then the url
|
||
<code>/icons</code> will not be aliased.</p>
|
||
|
||
<p>Note that you may need to specify additional <code class="directive"><a href="../mod/core.html#<directory>"><Directory></a></code> sections which cover
|
||
the <em>destination</em> of aliases. Aliasing occurs before
|
||
<code class="directive"><a href="../mod/core.html#<directory>"><Directory></a></code> sections
|
||
are checked, so only the destination of aliases are affected.
|
||
(Note however <code class="directive"><a href="../mod/core.html#<location>"><Location></a></code>
|
||
sections are run through once before aliases are performed, so
|
||
they will apply.)</p>
|
||
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AliasMatch" id="AliasMatch">AliasMatch</a> <a name="aliasmatch" id="aliasmatch">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Maps URLs to filesystem locations using regular
|
||
expressions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>AliasMatch <em>regex
|
||
file-path</em>|<em>directory-path</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<p>This directive is equivalent to <code class="directive"><a href="#alias">Alias</a></code>, 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>
|
||
<div class="example"><p><code>
|
||
AliasMatch ^/icons(.*) /usr/local/apache/icons$1
|
||
</code></p></div>
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="Redirect" id="Redirect">Redirect</a> <a name="redirect" id="redirect">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Sends an external redirect asking the client to fetch
|
||
a different URL</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>Redirect [<em>status</em>] <em>URL-path URL</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
|
||
</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<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. <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>.</p>
|
||
|
||
<p>Example:</p>
|
||
|
||
<div class="example"><p><code>Redirect /service http://foo2.bar.com/service</code></p></div>
|
||
|
||
<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>
|
||
|
||
<div class="note"><h3>Note</h3> <p>Redirect directives take precedence over
|
||
Alias and ScriptAlias 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 <code class="directive"><a href="../mod/core.html#<directory>"><Directory></a></code>
|
||
sections.</p></div>
|
||
|
||
<p>If no <em>status</em> argument is given, the redirect will
|
||
be "temporary" (HTTP status 302). This indicates to the client
|
||
that the resource has moved temporarily. The <em>status</em>
|
||
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 <em>url</em> argument should be omitted.</dd>
|
||
</dl>
|
||
|
||
<p>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 the function
|
||
<code>send_error_response</code> in http_protocol.c).</p>
|
||
|
||
<p>Example:</p>
|
||
|
||
<div class="example"><p><code>
|
||
Redirect permanent /one http://example.com/two<br />
|
||
Redirect 303 /three http://example.com/other
|
||
</code></p></div>
|
||
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RedirectMatch" id="RedirectMatch">RedirectMatch</a> <a name="redirectmatch" id="redirectmatch">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Sends an external redirect asking the client to fetch
|
||
a different URL based on a regular expression match of the
|
||
current URL</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>RedirectMatch [<em>status</em>] <em>regex URL</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
|
||
</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<p>This directive is equivalent to <code class="directive"><a href="#redirect">Redirect</a></code>, 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>
|
||
<div class="example"><p><code>
|
||
RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg
|
||
</code></p></div>
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RedirectPermanent" id="RedirectPermanent">RedirectPermanent</a> <a name="redirectpermanent" id="redirectpermanent">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Sends an external permanent redirect asking the client to fetch
|
||
a different URL</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>RedirectPermanent <em>URL-path URL</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
|
||
</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<p>This directive makes the client know that the Redirect is
|
||
permanent (status 301). Exactly equivalent to <code>Redirect
|
||
permanent</code>.</p>
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RedirectTemp" id="RedirectTemp">RedirectTemp</a> <a name="redirecttemp" id="redirecttemp">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Sends an external temporary redirect asking the client to fetch
|
||
a different URL</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>RedirectTemp <em>URL-path URL</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
|
||
</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<p>This directive makes the client know that the Redirect is
|
||
only temporary (status 302). Exactly equivalent to
|
||
<code>Redirect temp</code>.</p>
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ScriptAlias" id="ScriptAlias">ScriptAlias</a> <a name="scriptalias" id="scriptalias">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Maps a URL to a filesystem location and designates the
|
||
target as a CGI script</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>ScriptAlias
|
||
<em>URL-path file-path</em>|<em>directory-path</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<p>The <code class="directive">ScriptAlias</code> directive has the same
|
||
behavior as the <code class="directive"><a href="#alias">Alias</a></code>
|
||
directive, except that in addition it marks the target directory
|
||
as containing CGI scripts that will be processed by <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>'s cgi-script handler. URLs with a
|
||
(%-decoded) path beginning with <em>URL-path</em> will be mapped
|
||
to scripts beginning with the second argument which is a full
|
||
pathname in the local filesystem.</p>
|
||
|
||
<p>Example:</p>
|
||
|
||
<div class="example"><p><code>ScriptAlias /cgi-bin/ /web/cgi-bin/</code></p></div>
|
||
|
||
<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>
|
||
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ScriptAliasMatch" id="ScriptAliasMatch">ScriptAliasMatch</a> <a name="scriptaliasmatch" id="scriptaliasmatch">Directive</a></h2><table class="directive"><tr><th>Description:
|
||
</th><td>Maps a URL to a filesystem location using a regular expression
|
||
and designates the target as a CGI script</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
|
||
</a></th><td>ScriptAliasMatch
|
||
<em>regex file-path</em>|<em>directory-path</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
|
||
</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
|
||
</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
|
||
</a></th><td>mod_alias</td></tr></table>
|
||
<p>This directive is equivalent to <code class="directive"><a href="#scriptalias">ScriptAlias</a></code>, 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>
|
||
<div class="example"><p><code>
|
||
ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1
|
||
</code></p></div>
|
||
</div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div></body></html> |