diff options
Diffstat (limited to 'usr.sbin/httpd/htdocs/manual/mod/mod_alias.html')
-rw-r--r-- | usr.sbin/httpd/htdocs/manual/mod/mod_alias.html | 439 |
1 files changed, 349 insertions, 90 deletions
diff --git a/usr.sbin/httpd/htdocs/manual/mod/mod_alias.html b/usr.sbin/httpd/htdocs/manual/mod/mod_alias.html index 247cdc35ade..affa6d3cc9f 100644 --- a/usr.sbin/httpd/htdocs/manual/mod/mod_alias.html +++ b/usr.sbin/httpd/htdocs/manual/mod/mod_alias.html @@ -15,140 +15,400 @@ <DIV ALIGN="CENTER"> <IMG SRC="../images/sub.gif" ALT="[APACHE DOCUMENTATION]"> <H3> - Apache HTTP Server Version 1.2 + Apache HTTP Server Version 1.3 </H3> </DIV> -<H1 ALIGN="CENTER">Module mod_alias</h1> - -This module is contained in the <code>mod_alias.c</code> file, and +<H1 ALIGN="CENTER">Module mod_alias</H1> +<P> +This module is contained in the <CODE>mod_alias.c</CODE> file, and is compiled in by default. It provides for mapping different parts of the host filesystem in the the document tree, and for URL redirection. +</P> - -<menu> -<li><A HREF="#alias">Alias</A> -<li><A HREF="#redirect">Redirect</A> -<li><A HREF="#redirecttemp">RedirectTemp</A> -<li><A HREF="#redirectperm">RedirectPermanent</A> -<li><A HREF="#scriptalias">ScriptAlias</A> -</menu> -<hr> +<H2>Directives</H2> +<UL> +<LI><A HREF="#alias">Alias</A> +<LI><A HREF="#aliasmatch">AliasMatch</A> +<LI><A HREF="#redirect">Redirect</A> +<LI><A HREF="#redirectmatch">RedirectMatch</A> +<LI><A HREF="#redirecttemp">RedirectTemp</A> +<LI><A HREF="#redirectperm">RedirectPermanent</A> +<LI><A HREF="#scriptalias">ScriptAlias</A> +<LI><A HREF="#scriptaliasmatch">ScriptAliasMatch</A> +</UL> +<HR> -<A name="alias"><h2>Alias</h2></A> +<H2><A NAME="alias">Alias directive</A></H2> +<P> <!--%plaintext <?INDEX {\tt Alias} directive> --> -<strong>Syntax:</strong> Alias <em>url-path directory-filename</em><br> -<Strong>Context:</strong> server config, virtual host<br> -<strong>Status:</strong> Base<br> -<strong>Module:</strong> mod_alias<br> - +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> Alias <EM>url-path directory-filename</EM><BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias +</P> +<P> The Alias directive allows documents to be stored in the local filesystem other than under the <A HREF="core.html#documentroot">DocumentRoot</A>. -URLs with a (%-decoded) path beginning with <em>url-path</em> will be -mapped to local files beginning with <em>directory-filename</em>. +URLs with a (%-decoded) path beginning with <EM>url-path</EM> will be +mapped to local files beginning with <EM>directory-filename</EM>. +<P> Example: -<blockquote><code>Alias /image /ftp/pub/image</code></blockquote> +</P> +<BLOCKQUOTE><CODE>Alias /image /ftp/pub/image</CODE></BLOCKQUOTE> +<P> A request for http://myserver/image/foo.gif would cause the server to -return the file /ftp/pub/image/foo.gif.<p> - -Note that if you include a trailing / on the <em>url-path</em> then the +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/etc/httpd/icons/</code> then -the url <code>/icons</code> will not be aliased.<p> +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 +<A HREF="core.html#directory"><CODE><Directory></CODE></A> sections +which cover the <EM>destination</EM> of aliases. Aliasing occurs +before <CODE><Directory></CODE> sections are checked, so only +the destination of aliases are affected. (Note however +<A HREF="core.html#location"><CODE><Location></CODE></A> +sections are run through once before aliases are performed, so they +will apply.) +<P> +See also <A HREF="#scriptalias">ScriptAlias</A>. +</P> +<HR> -See also <A HREF="#scriptalias">ScriptAlias</A>.<p><hr> +<H2><A NAME="aliasmatch">AliasMatch</A></H2> +<P> +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> AliasMatch <EM>regex directory-filename</EM><BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias<BR> +<A + HREF="directive-dict.html#Compatibility" + REL="Help" +><STRONG>Compatibility:</STRONG></A> Available in Apache 1.3 and later +</P> -<A name="redirect"><h2>Redirect</h2></A> -<!--%plaintext <?INDEX {\tt Redirect} directive> --> -<strong>Syntax:</strong> Redirect [ <em>status</em> ] <em>url-path url</em><br> -<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br> -<strong>Status:</strong> Base<br> -<strong>Module:</strong> mod_alias<br> -<strong>Compatibility:</strong> The directory and .htaccess context's -are only available in versions 1.1 and later. The <em>status</em> argument is only available in Apache 1.2 or later.<p> +<P>This directive is equivalent to <A HREF="#alias">Alias</A>, but +makes use of standard regular expressions, instead of simple prefix +matching. The supplied regular expression is matched against the URL, +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: +<PRE> + AliasMatch ^/icons(.*) /usr/local/apache/icons$1 +</PRE> +</P> +<HR> + +<H2><A NAME="redirect">Redirect directive</A></H2> +<P> +<!--%plaintext <?INDEX {\tt Redirect} directive> --> +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> Redirect [ <EM>status</EM> ] + <EM>url-path url</EM><BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host, directory, + .htaccess<BR> +<A + HREF="directive-dict.html#Override" + REL="Help" +><STRONG>Override:</STRONG></A> FileInfo<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias<BR> +<A + HREF="directive-dict.html#Compatibility" + REL="Help" +><STRONG>Compatibility:</STRONG></A> The directory and .htaccess context's +are only available in versions 1.1 and later. The <EM>status</EM> +argument is only available in Apache 1.2 or later. +</P> +<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 +<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>. Example: -<blockquote><code>Redirect /service -http://foo2.bar.com/service</code></blockquote> +beginning with <EM>url</EM>. +</P> +<P> +Example: +</P> +<BLOCKQUOTE><CODE>Redirect /service +http://foo2.bar.com/service</CODE></BLOCKQUOTE> +<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: Redirect directives take precedence over Alias and ScriptAlias +access http://foo2.bar.com/service/foo.txt instead. +</P> +<P> +<STRONG>Note:</STRONG> 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 <Directory> sections.<p> - -If no <em>status</em> argument is given, the redirect will be -"temporary" (HTTP status 302). This indicates to the client that the -resources is has moved temporarily. The <em>status</em> +<EM>Url-path</EM> must be an absolute path, not a relative path, even +when used with .htaccess files or inside of <Directory> sections. +</P> +<P> +If no <EM>status</EM> argument is given, the redirect will be +"temporary" (HTTP status 302). This indicates to the client that the +resources is has moved temporarily. The <EM>status</EM> argument can be used to return other HTTP status codes: -<dl> -<dt>permanent<dd>Returns a permanent redirect status (301) indicating that +<P> +<DL> +<DT>permanent +<DD>Returns a permanent redirect status (301) indicating that the resource has moved permanently. -<dt>temp<dd>Returns a temporary redirect status (302). This is the +<DT>temp +<DD>Returns a temporary redirect status (302). This is the default. -<dt>seeother<dd>Returns a "See Other" status (303) indicating that +<DT>seeother +<DD>Returns a "See Other" status (303) indicating that the resource has been replaced. -<dt>gone<dd>Returns a "Gone" status (410) indicating that the resource -has been permanently removed. When this status is used the <em>url</em> +<DT>gone +<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. -</dl> - +</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 +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). +the function <CODE>send_error_response</CODE> in http_protocol.c). +</P> +<HR> -<A name="redirecttemp"><h2>RedirectTemp</h2></A> -<!--%plaintext <?INDEX {\tt Redirect} directive> --> -<strong>Syntax:</strong> RedirectTemp <em>url-path url</em><br> -<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br> -<strong>Status:</strong> Base<br> -<strong>Module:</strong> mod_alias<br> -<strong>Compatibility:</strong> This directive is only available in 1.2<P> +<H2><A NAME="redirectmatch">RedirectMatch</A></H2> +<P> +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> + RedirectMatch [<EM>status</EM>] <EM>regex url</EM> +<BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host<BR> +<A + HREF="directive-dict.html#Override" + REL="Help" +><STRONG>Override:</STRONG></A> FileInfo<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias<BR> +<A + HREF="directive-dict.html#Compatibility" + REL="Help" +><STRONG>Compatibility:</STRONG></A> Available in Apache 1.3 and later +</P> -This directive makes the client know that the Redirect is only -temporary. (Status 302). Exactly equivalent to <code>Redirect temporary </code><P> +<P>This directive is equivalent to <A HREF="#alias">Redirect</A>, but +makes use of standard regular expressions, instead of simple prefix +matching. The supplied regular expression is matched against the URL, +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: +<PRE> + RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg +</PRE> +</P> + +<HR> -<A name="redirectperm"><h2>RedirectPermanent</h2></A> +<H2><A NAME="redirecttemp">RedirectTemp directive</A></H2> +<P> <!--%plaintext <?INDEX {\tt Redirect} directive> --> -<strong>Syntax:</strong> RedirectPermanent <em>url-path url</em><br> -<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br> -<strong>Status:</strong> Base<br> -<strong>Module:</strong> mod_alias<br> -<strong>Compatibility:</strong> This directive is only available in 1.2<P> +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> RedirectTemp <EM>url-path url</EM><BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host, directory, + .htaccess<BR> +<A + HREF="directive-dict.html#Override" + REL="Help" +><STRONG>Override:</STRONG></A> FileInfo<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias<BR> +<A + HREF="directive-dict.html#Compatibility" + REL="Help" +><STRONG>Compatibility:</STRONG></A> This directive is only available in 1.2 +</P> +<P> +This directive makes the client know that the Redirect is only +temporary (status 302). Exactly equivalent to <CODE>Redirect +temporary</CODE>. +</P> +<HR> -This directive makes the client know that the Redirect is permanent. -(Status 301). Exactly equivalent to <code>Redirect permanent</code><P> +<H2><A NAME="redirectperm">RedirectPermanent directive</A></H2> +<P> +<!--%plaintext <?INDEX {\tt Redirect} directive> --> +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> RedirectPermanent <EM>url-path url</EM><BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host, directory, + .htaccess<BR> +<A + HREF="directive-dict.html#Override" + REL="Help" +><STRONG>Override:</STRONG></A> FileInfo<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias<BR> +<A + HREF="directive-dict.html#Compatibility" + REL="Help" +><STRONG>Compatibility:</STRONG></A> This directive is only available in 1.2 +</P> +<P> +This directive makes the client know that the Redirect is permanent +(status 301). Exactly equivalent to <CODE>Redirect permanent</CODE>. +</P> +<HR> -<hr> -<A name="scriptalias"><h2>ScriptAlias</h2></A> +<H2><A NAME="scriptalias">ScriptAlias directive</A></H2> +<P> <!--%plaintext <?INDEX {\tt ScriptAlias} directive> --> -<strong>Syntax:</strong> ScriptAlias <em>url-path directory-filename</em><br> -<Strong>Context:</strong> server config, virtual host<br> -<strong>Status:</strong> Base<br> -<strong>Module:</strong> mod_alias<br> - +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> ScriptAlias <EM>url-path directory-filename</EM> +<BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias +</P> +<P> The ScriptAlias directive has the same behavior as the <A HREF="#alias">Alias</A> directive, except that in addition it marks the target directory as containing CGI scripts. -URLs with a (%-decoded) path beginning with <em>url-path</em> will be -mapped to scripts beginning with <em>directory-filename</em>. +URLs with a (%-decoded) path beginning with <EM>url-path</EM> will be +mapped to scripts beginning with <EM>directory-filename</EM>. +<P> Example: -<blockquote><code>ScriptAlias /cgi-bin/ /web/cgi-bin/</code></blockquote> +</P> +<BLOCKQUOTE><CODE>ScriptAlias /cgi-bin/ /web/cgi-bin/</CODE></BLOCKQUOTE> +<P> A request for http://myserver/cgi-bin/foo would cause the server to -run the script /web/cgi-bin/foo.<p> +run the script /web/cgi-bin/foo. +</P> <HR> + +<H2><A NAME="scriptaliasmatch">ScriptAliasMatch</A></H2> +<P> +<A + HREF="directive-dict.html#Syntax" + REL="Help" +><STRONG>Syntax:</STRONG></A> ScriptAliasMatch + <EM>regex directory-filename</EM><BR> +<A + HREF="directive-dict.html#Context" + REL="Help" +><STRONG>Context:</STRONG></A> server config, virtual host<BR> +<A + HREF="directive-dict.html#Status" + REL="Help" +><STRONG>Status:</STRONG></A> Base<BR> +<A + HREF="directive-dict.html#Module" + REL="Help" +><STRONG>Module:</STRONG></A> mod_alias<BR> +<A + HREF="directive-dict.html#Compatibility" + REL="Help" +><STRONG>Compatibility:</STRONG></A> Available in Apache 1.3 and later +</P> + +<P>This directive is equivalent to <A HREF="#scriptalias">ScriptAlias</A>, but +makes use of standard regular expressions, instead of simple prefix +matching. The supplied regular expression is matched against the URL, +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: +<PRE> + ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1 +</PRE> +</P> + +<HR> + <H3 ALIGN="CENTER"> - Apache HTTP Server Version 1.2 + Apache HTTP Server Version 1.3 </H3> <A HREF="./"><IMG SRC="../images/index.gif" ALT="Index"></A> @@ -156,4 +416,3 @@ run the script /web/cgi-bin/foo.<p> </BODY> </HTML> - |