mod_alias.xml revision 7647551a51db086eef1f5b651b2d6f174dffb8b3
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Copyright 2002-2004 The Apache Software Foundation
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Licensed under the Apache License, Version 2.0 (the "License");
a78048ccbdb6256da15e6b0e7e95355e480c2301nd you may not use this file except in compliance with the License.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd You may obtain a copy of the License at
a78048ccbdb6256da15e6b0e7e95355e480c2301nd Unless required by applicable law or agreed to in writing, software
27e52281f1522522b170cafc76b08b58aa70ccaand distributed under the License is distributed on an "AS IS" BASIS,
a78048ccbdb6256da15e6b0e7e95355e480c2301nd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd See the License for the specific language governing permissions and
a78048ccbdb6256da15e6b0e7e95355e480c2301nd limitations under the License.
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<description>Provides for mapping different parts of the host
a78048ccbdb6256da15e6b0e7e95355e480c2301nd filesystem in the document tree and for URL redirection</description>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <p>The directives contained in this module allow for manipulation
a78048ccbdb6256da15e6b0e7e95355e480c2301nd and control of URLs as requests arrive at the server. The
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <directive module="mod_alias">Alias</directive> and <directive
a78048ccbdb6256da15e6b0e7e95355e480c2301nd module="mod_alias">ScriptAlias</directive> directives are used to
a78048ccbdb6256da15e6b0e7e95355e480c2301nd map between URLs and filesystem paths. This allows for content
a78048ccbdb6256da15e6b0e7e95355e480c2301nd which is not directly under the <directive
a78048ccbdb6256da15e6b0e7e95355e480c2301nd module="core">DocumentRoot</directive> served as part of the web
a78048ccbdb6256da15e6b0e7e95355e480c2301nd document tree. The <directive
a78048ccbdb6256da15e6b0e7e95355e480c2301nd module="mod_alias">ScriptAlias</directive> directive has the
a78048ccbdb6256da15e6b0e7e95355e480c2301nd additional effect of marking the target directory as containing
a78048ccbdb6256da15e6b0e7e95355e480c2301nd only CGI scripts.</p>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <p>The <directive module="mod_alias">Redirect</directive>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd directives are used to instruct clients to make a new request with
a78048ccbdb6256da15e6b0e7e95355e480c2301nd a different URL. They are often used when a resource has moved to
a78048ccbdb6256da15e6b0e7e95355e480c2301nd a new location.</p>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<seealso><module>mod_rewrite</module></seealso> <seealso><a
a78048ccbdb6256da15e6b0e7e95355e480c2301ndhref="/urlmapping.html">Mapping URLs to the filesystem</a></seealso>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<p>Aliases and Redirects occuring in different contexts are processed
a78048ccbdb6256da15e6b0e7e95355e480c2301ndlike other directives according to standard <a
a78048ccbdb6256da15e6b0e7e95355e480c2301ndhref="/sections.html#mergin">merging rules</a>. But when multiple
a78048ccbdb6256da15e6b0e7e95355e480c2301ndAliases or Redirects occur in the same context (for example, in the
a78048ccbdb6256da15e6b0e7e95355e480c2301ndsame <directive type="section" module="core">VirtualHost</directive>
a78048ccbdb6256da15e6b0e7e95355e480c2301ndsection) they are processed in a particular order.</p>
8bb7126c063c34d63966733988411f72dfcb2294maczniak<p>First, all Redirects are processed before Aliases are processed,
8bb7126c063c34d63966733988411f72dfcb2294maczniakand therefore a request that matches a <directive
8bb7126c063c34d63966733988411f72dfcb2294maczniakmodule="mod_alias">Redirect</directive> or <directive
a78048ccbdb6256da15e6b0e7e95355e480c2301ndmodule="mod_alias">RedirectMatch</directive> will never have Aliases
a78048ccbdb6256da15e6b0e7e95355e480c2301ndapplied. Second, the Aliases and Redirects are processed in the order
a78048ccbdb6256da15e6b0e7e95355e480c2301ndthey appear in the configuration files, with the first match taking
a78048ccbdb6256da15e6b0e7e95355e480c2301ndprecedence.</p>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<p>For this reason, when two or more of these directives apply to the
a78048ccbdb6256da15e6b0e7e95355e480c2301ndsame sub-path, you must list the most specific path first in order for
a78048ccbdb6256da15e6b0e7e95355e480c2301ndall the directives to have an effect. For example, the following
a78048ccbdb6256da15e6b0e7e95355e480c2301ndconfiguration will work as expected:</p>
a78048ccbdb6256da15e6b0e7e95355e480c2301ndAlias /foo /gaq
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<p>But if the above two directives were reversed in order, the
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<code>/foo</code> <directive module="mod_alias">Alias</directive>
a78048ccbdb6256da15e6b0e7e95355e480c2301ndwould always match before the <code>/foo/bar</code> <directive
a78048ccbdb6256da15e6b0e7e95355e480c2301ndmodule="mod_alias">Alias</directive>, so the latter directive would be
a78048ccbdb6256da15e6b0e7e95355e480c2301ndignored.</p>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<directivesynopsis>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<description>Maps URLs to filesystem locations</description>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<contextlist><context>server config</context><context>virtual host</context>
e23d878014f00a27b043a25e59f809c7af497e5ctakashi</contextlist>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <p>The <directive>Alias</directive> directive allows documents to
a78048ccbdb6256da15e6b0e7e95355e480c2301nd be stored in the local filesystem other than under the
Redirect /service http://foo2.bar.com/service
will be told to access http://foo2.bar.com/service/foo.txt
Redirect 303 /three http://example.com/other
RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg