mod_alias.html revision a8ecae3daae0783f567d84822270df4038ef0c9d
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<HTML>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<HEAD>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<TITLE>Apache module mod_alias</TITLE>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd</HEAD>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<BODY>
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<!--#include virtual="header.html" -->
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<H1>Module mod_alias</h1>
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding
db479b48bd4d75423ed4a45e15b75089d1a8ad72fieldingThis module is contained in the <code>mod_alias.c</code> file, and
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdndis compiled in by default. It provides for mapping different parts of the
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdndhost filesystem in the the document tree, and for URL redirection.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<menu>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<li><A HREF="#alias">Alias</A>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<li><A HREF="#redirect">Redirect</A>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<li><A HREF="#redirecttemp">RedirectTemp</A>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<li><A HREF="#redirectperm">RedirectPermanent</A>
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<li><A HREF="#scriptalias">ScriptAlias</A>
7db9f691a00ead175b03335457ca296a33ddf31bnd</menu>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<hr>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz
9e5acc39290b3341429131dfb126394871e9837drbowen
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<A name="alias"><h2>Alias</h2></A>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<!--%plaintext &lt;?INDEX {\tt Alias} directive&gt; -->
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Syntax:</strong> Alias <em>url-path directory-filename</em><br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<Strong>Context:</strong> server config, virtual host<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Status:</strong> Base<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Module:</strong> mod_alias<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Compatibility:</strong> Alias is only available in Apache 1.1
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantzand later<p>
3604deb3632beeca54cfdb3864d872715971c300slive
3604deb3632beeca54cfdb3864d872715971c300sliveThe Alias directive allows documents to be stored in the local filesystem
3604deb3632beeca54cfdb3864d872715971c300sliveother than under the <A HREF="core.html#documentroot">DocumentRoot</A>.
3604deb3632beeca54cfdb3864d872715971c300sliveURLs with a (%-decoded) path beginning with <em>url-path</em> will be
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantzmapped to local files beginning with <em>directory-filename</em>.
87a0e78ba862eb998ccd545ae27c46c7ef89215abnicholesExample:
87a0e78ba862eb998ccd545ae27c46c7ef89215abnicholes<blockquote><code>Alias /image /ftp/pub/image</code></blockquote>
87a0e78ba862eb998ccd545ae27c46c7ef89215abnicholesA request for http://myserver/image/foo.gif would cause the server to
92988aaf68a67c9fa417556cb944eba6bb82ef92rbowenreturn the file /ftp/pub/image/foo.gif.<p>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantzSee also <A HREF="#scriptalias">ScriptAlias</A>.<p><hr>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<A name="redirect"><h2>Redirect</h2></A>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
3604deb3632beeca54cfdb3864d872715971c300slive<strong>Syntax:</strong> Redirect <em>url-path url</em><br>
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
3604deb3632beeca54cfdb3864d872715971c300slive<strong>Status:</strong> Base<br>
f07998c217193b829f55c5ca8f4313ad5ba28f84nd<strong>Module:</strong> mod_alias<br>
f07998c217193b829f55c5ca8f4313ad5ba28f84nd<strong>Compatibility:</strong> The directory and .htaccess context's
f07998c217193b829f55c5ca8f4313ad5ba28f84ndare only available in versions 1.1 and later<p>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantzThe Redirect directive maps an old URL into a new one. The new URL is returned
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jimto the client which attempts to fetch it again with the new address.
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd<em>Url-path</em> a (%-decoded) path; any requests for documents beginning with
3604deb3632beeca54cfdb3864d872715971c300slivethis path will be returned a redirect error to a new (%-encoded) url
3604deb3632beeca54cfdb3864d872715971c300slivebeginning with <em>url</em>. Example:
3604deb3632beeca54cfdb3864d872715971c300slive<blockquote><code>Redirect /service
35ffb30f57f777dbf3f17c5a5ddf706559942c16ndhttp://foo2.bar.com/service</code></blockquote>
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedoohIf the client requests http://myserver/service/foo.txt, it will be told to
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedoohaccess http://foo2.bar.com/service/foo.txt instead.<p>
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedoohNote: Redirect directives take precedence over Alias and ScriptAlias
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedoohdirectives, irrespective of their ordering in the configuration file.<p>
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedooh
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedooh<A name="redirecttemp"><h2>RedirectTemp</h2></A>
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedooh<!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedooh<strong>Syntax:</strong> RedirectTemp <em>url-path url</em><br>
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedooh<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
6f10385908fbdfd4849e4bc50e690ee54c62f2cdhumbedooh<strong>Status:</strong> Base<br>
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd<strong>Module:</strong> mod_alias<br>
41618b507c149c7adf89bd92a0cc2c6962a29dcfcovener<strong>Compatibility:</strong> This directive is only available in 1.2<P>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
41618b507c149c7adf89bd92a0cc2c6962a29dcfcovenerThis directive makes the client know that the Redirect is only
41618b507c149c7adf89bd92a0cc2c6962a29dcfcovenertemporary. (Status 302).<P>
41618b507c149c7adf89bd92a0cc2c6962a29dcfcovener
3604deb3632beeca54cfdb3864d872715971c300slive<A name="redirectperm"><h2>RedirectPermanent</h2></A>
3604deb3632beeca54cfdb3864d872715971c300slive<!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
5632f75dd34db0112cf4b6b7527eb538c80d976cniq<strong>Syntax:</strong> RedirectPermanent <em>url-path url</em><br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Status:</strong> Base<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Module:</strong> mod_alias<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Compatibility:</strong> This directive is only available in 1.2<P>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz
35ffb30f57f777dbf3f17c5a5ddf706559942c16ndThis directive makes the client know that the Redirect is permanent.
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd(Status 301).<P>
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd<hr>
35ffb30f57f777dbf3f17c5a5ddf706559942c16nd<A name="scriptalias"><h2>ScriptAlias</h2></A>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<!--%plaintext &lt;?INDEX {\tt ScriptAlias} directive&gt; -->
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Syntax:</strong> ScriptAlias <em>url-path directory-filename</em><br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<Strong>Context:</strong> server config, virtual host<br>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<strong>Status:</strong> Base<br>
3604deb3632beeca54cfdb3864d872715971c300slive<strong>Module:</strong> mod_alias<br>
3604deb3632beeca54cfdb3864d872715971c300slive<strong>Compatibility:</strong> ScriptAlias is only available in Apache 1.1
3604deb3632beeca54cfdb3864d872715971c300sliveand later<p>
3604deb3632beeca54cfdb3864d872715971c300slive
3604deb3632beeca54cfdb3864d872715971c300sliveThe ScriptAlias directive has the same behaviour as the
3604deb3632beeca54cfdb3864d872715971c300slive<A HREF="#alias">Alias</A> directive, except that in addition it
3604deb3632beeca54cfdb3864d872715971c300slivemarks the target directory as containing CGI scripts.
3604deb3632beeca54cfdb3864d872715971c300sliveURLs with a (%-decoded) path beginning with <em>url-path</em> will be
3604deb3632beeca54cfdb3864d872715971c300slivemapped to scripts beginning with <em>directory-filename</em>.
3604deb3632beeca54cfdb3864d872715971c300sliveExample:
3604deb3632beeca54cfdb3864d872715971c300slive<blockquote><code>ScriptAlias /cgi-bin/ /web/cgi-bin/</code></blockquote>
3604deb3632beeca54cfdb3864d872715971c300sliveA request for http://myserver/cgi-bin/foo would cause the server to
3604deb3632beeca54cfdb3864d872715971c300sliverun the script /web/cgi-bin/foo.<p>
3604deb3632beeca54cfdb3864d872715971c300slive
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz<!--#include virtual="footer.html" -->
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz</BODY>
f43ed9051a7f4db461d67ed4f7ece175b3dbca7cjerenkrantz</HTML>
fbc5cf5c3505692a5a250416bba8bc785783364aminfrin
fbc5cf5c3505692a5a250416bba8bc785783364aminfrin