a different URL. They are often used when a resource has moved to
a new location.</p>
+ <p>When the <code class="directive"><a href="#alias">Alias</a></code>,
+ <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> and
+ <code class="directive"><a href="#redirect">Redirect</a></code> directives are used
+ within a <code class="directive"><a href="../mod/core.html#location"><Location></a></code>
+ or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>
+ section, <a href="../expr.html">expression syntax</a> can be used
+ to manipulate the destination path or URL.
+ </p>
+
<p><code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> is designed to handle simple URL
manipulation tasks. For more complicated tasks such as
manipulating the query string, use the tools provided by
would always match before the <code>/foo/bar</code> <code class="directive"><a href="#alias">Alias</a></code>, so the latter directive would be
ignored.</p>
+ <p>When the <code class="directive"><a href="#alias">Alias</a></code>,
+ <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> and
+ <code class="directive"><a href="#redirect">Redirect</a></code> directives are used
+ within a <code class="directive"><a href="../mod/core.html#location"><Location></a></code>
+ or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>
+ section, these directives will take precedence over any globally
+ defined <code class="directive"><a href="#alias">Alias</a></code>,
+ <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> and
+ <code class="directive"><a href="#redirect">Redirect</a></code> directives.</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="Alias" id="Alias">Alias</a> <a name="alias" id="alias">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps URLs to filesystem locations</td></tr>
-<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Alias <var>URL-path</var>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Alias [<var>URL-path</var>]
<var>file-path</var>|<var>directory-path</var></code></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#Context">Context:</a></th><td>server config, virtual host, directory</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>Any number slashes in the <var>URL-path</var> parameter
matches any number of slashes in the requested URL-path.</p>
+ <p>If the <code class="directive">Alias</code> directive is used within a
+ <code class="directive"><a href="../mod/core.html#location"><Location></a></code>
+ or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>
+ section the URL-path is omitted, and the file-path is interpreted
+ using <a href="../expr.html">expression syntax</a>.</p>
+
+ <pre class="prettyprint lang-config"><Location /image>
+ Alias /ftp/pub/image
+</Location>
+<LocationMatch /error/(?<NUMBER>[0-9]+)>
+ Alias /usr/local/apache/errors/%{env:MATCH_NUMBER}.html
+</LocationMatch></pre>
+
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></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><code>Redirect [<var>status</var>] <var>URL-path</var>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Redirect [<var>status</var>] [<var>URL-path</var>]
<var>URL</var></code></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>
Note that <code>POST</code>s will be discarded.<br />
Only complete path segments are matched, so the above
example would not match a request for
- <code>http://example.com/servicefoo.txt</code>. For more complex matching
- using regular expressions, see the <code class="directive"><a href="#redirectmatch">RedirectMatch</a></code> directive.</p>
+ <code>http://example.com/servicefoo.txt</code>. For more complex matching
+ using the <a href="../expr.html">expression syntax</a>, omit the URL-path
+ argument as described below. Alternatively, for matching using regular
+ expressions, see the <code class="directive"><a href="#redirectmatch">RedirectMatch</a></code> directive.</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.</p></div>
+ file. Redirect directives inside a Location take precedence over
+ Redirect and Alias directives with an URL-path.</p></div>
<p>If no <var>status</var> argument is given, the redirect will
be "temporary" (HTTP status 302). This indicates to the client
Redirect 303 /three http://example.com/other</pre>
+ <p>If the <code class="directive">Redirect</code> directive is used within a
+ <code class="directive"><a href="../mod/core.html#location"><Location></a></code>
+ or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>
+ section with the URL-path omitted, then the URL parameter will be
+ interpreted using <a href="../expr.html">expression syntax</a>.</p>
+
+ <pre class="prettyprint lang-config"><Location /one>
+ Redirect permanent http://example.com/two
+</Location><br />
+<Location /three>
+ Redirect 303 http://example.com/other
+</Location><br />
+<LocationMatch /error/(?<NUMBER>[0-9]+)>
+ Redirect permanent http://example.com/errors/%{env:MATCH_NUMBER}.html
+</LocationMatch><br />
+ </pre>
+
+
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></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><code>ScriptAlias <var>URL-path</var>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScriptAlias [<var>URL-path</var>]
<var>file-path</var>|<var>directory-path</var></code></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#Context">Context:</a></th><td>server config, virtual host, directory</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>
of the CGI scripts if they are not restricted by a
<code class="directive"><a href="../mod/core.html#directory">Directory</a></code> section.</div>
+ <p>If the <code class="directive">ScriptAlias</code> directive is used within
+ a <code class="directive"><a href="../mod/core.html#location"><Location></a></code>
+ or <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>
+ section with the URL-path omitted, then the URL parameter will be
+ interpreted using <a href="../expr.html">expression syntax</a>.</p>
+
+ <pre class="prettyprint lang-config"><Location /cgi-bin >
+ ScriptAlias /web/cgi-bin/
+</Location>
+<LocationMatch /cgi-bin/errors/(?<NUMBER>[0-9]+)>
+ ScriptAlias /web/cgi-bin/errors/%{env:MATCH_NUMBER}.cgi
+</LocationMatch><br />
+ </pre>
+
+
<h3>See also</h3>
<ul>
<tr><td><a href="mod_mime.html#addtype">AddType <var>media-type</var> <var>extension</var>
[<var>extension</var>] ...</a></td><td></td><td>svdh</td><td>B</td></tr><tr><td class="descr" colspan="4">Maps the given filename extensions onto the specified content
type</td></tr>
-<tr class="odd"><td><a href="mod_alias.html#alias">Alias <var>URL-path</var>
-<var>file-path</var>|<var>directory-path</var></a></td><td></td><td>sv</td><td>B</td></tr><tr class="odd"><td class="descr" colspan="4">Maps URLs to filesystem locations</td></tr>
+<tr class="odd"><td><a href="mod_alias.html#alias">Alias [<var>URL-path</var>]
+<var>file-path</var>|<var>directory-path</var></a></td><td></td><td>svd</td><td>B</td></tr><tr class="odd"><td class="descr" colspan="4">Maps URLs to filesystem locations</td></tr>
<tr><td><a href="mod_alias.html#aliasmatch">AliasMatch <var>regex</var>
<var>file-path</var>|<var>directory-path</var></a></td><td></td><td>sv</td><td>B</td></tr><tr><td class="descr" colspan="4">Maps URLs to filesystem locations using regular
expressions</td></tr>
<tr><td><a href="mod_autoindex.html#readmename" id="R" name="R">ReadmeName <var>filename</var></a></td><td></td><td>svdh</td><td>B</td></tr><tr><td class="descr" colspan="4">Name of the file that will be inserted at the end
of the index listing</td></tr>
<tr class="odd"><td><a href="mpm_common.html#receivebuffersize">ReceiveBufferSize <var>bytes</var></a></td><td> 0 </td><td>s</td><td>M</td></tr><tr class="odd"><td class="descr" colspan="4">TCP receive buffer size</td></tr>
-<tr><td><a href="mod_alias.html#redirect">Redirect [<var>status</var>] <var>URL-path</var>
+<tr><td><a href="mod_alias.html#redirect">Redirect [<var>status</var>] [<var>URL-path</var>]
<var>URL</var></a></td><td></td><td>svdh</td><td>B</td></tr><tr><td class="descr" colspan="4">Sends an external redirect asking the client to fetch
a different URL</td></tr>
<tr class="odd"><td><a href="mod_alias.html#redirectmatch">RedirectMatch [<var>status</var>] <var>regex</var>
the child processes</td></tr>
<tr><td><a href="mod_actions.html#script">Script <var>method</var> <var>cgi-script</var></a></td><td></td><td>svd</td><td>B</td></tr><tr><td class="descr" colspan="4">Activates a CGI script for a particular request
method.</td></tr>
-<tr class="odd"><td><a href="mod_alias.html#scriptalias">ScriptAlias <var>URL-path</var>
-<var>file-path</var>|<var>directory-path</var></a></td><td></td><td>sv</td><td>B</td></tr><tr class="odd"><td class="descr" colspan="4">Maps a URL to a filesystem location and designates the
+<tr class="odd"><td><a href="mod_alias.html#scriptalias">ScriptAlias [<var>URL-path</var>]
+<var>file-path</var>|<var>directory-path</var></a></td><td></td><td>svd</td><td>B</td></tr><tr class="odd"><td class="descr" colspan="4">Maps a URL to a filesystem location and designates the
target as a CGI script</td></tr>
<tr><td><a href="mod_alias.html#scriptaliasmatch">ScriptAliasMatch <var>regex</var>
<var>file-path</var>|<var>directory-path</var></a></td><td></td><td>sv</td><td>B</td></tr><tr><td class="descr" colspan="4">Maps a URL to a filesystem location using a regular expression