mod_rewrite.xml revision 39d67f66729a7008c1e73d65a81e778ce819a227
013e1ddd21f2142a369c9a9a0eeb6c6a0bc3fcf3patrikj<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $LastChangedRevision$ -->
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding the License. You may obtain a copy of the License at
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd Unless required by applicable law or agreed to in writing, software
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd distributed under the License is distributed on an "AS IS" BASIS,
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd See the License for the specific language governing permissions and
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd limitations under the License.
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<description>Provides a rule-based rewriting engine to rewrite requested
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveURLs on the fly</description>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin <p>The <module>mod_rewrite</module> module uses a rule-based rewriting
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin engine, based on a regular-expression parser, to rewrite requested URLs on
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin the fly. By default, <module>mod_rewrite</module> maps a URL to a filesystem
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin path. However, it can also be used to redirect one URL to another URL, or
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin to invoke an internal proxy fetch.</p>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin <p><module>mod_rewrite</module> provides a flexible and powerful way to
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin manipulate URLs using an unlimited number of rules. Each rule can have an
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin unlimited number of attached rule conditions, to allow you to rewrite URL
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin based on server variables, environment variables, HTTP headers, or time
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin stamps.</p>
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin <p><module>mod_rewrite</module> operates on the full URL path, including the
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin path-info section. A rewrite rule can be invoked in
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin <code>httpd.conf</code> or in <code>.htaccess</code>. The path generated
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin by a rewrite rule can include a query string, or can lead to internal
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin sub-processing, external request redirection, or internal proxy
f6445f3ad1c82f9398dc8edd77093cd3e20b806cnoirin throughput.</p>
f0a393c5c2d7de58f447855369ad2fbfa254e544rbowen <p>Further details, discussion, and examples, are provided in the
f0a393c5c2d7de58f447855369ad2fbfa254e544rbowen <a href="/rewrite/">detailed mod_rewrite documentation</a>.</p>
bc36e90829b1ee123307a2339519265139a88173sf <p><module>mod_rewrite</module> offers detailed logging of its actions
bc36e90829b1ee123307a2339519265139a88173sf at the <code>trace1</code> to <code>trace8</code> log levels. The
bc36e90829b1ee123307a2339519265139a88173sf log level can be set specifically for <module>mod_rewrite</module>
bc36e90829b1ee123307a2339519265139a88173sf using the <directive module="core">LogLevel</directive> directive: Up to
bc36e90829b1ee123307a2339519265139a88173sf level <code>debug</code>, no actions are logged, while <code>trace8</code>
bc36e90829b1ee123307a2339519265139a88173sf means that practically all actions are logged.</p>
bc36e90829b1ee123307a2339519265139a88173sf Using a high trace log level for <module>mod_rewrite</module>
bc36e90829b1ee123307a2339519265139a88173sf will slow down your Apache HTTP Server dramatically! Use a log
bc36e90829b1ee123307a2339519265139a88173sf LogLevel rewrite:trace3
bc36e90829b1ee123307a2339519265139a88173sf </example>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<directivesynopsis>
013e1ddd21f2142a369c9a9a0eeb6c6a0bc3fcf3patrikj<description>Enables or disables runtime rewriting engine</description>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<contextlist><context>server config</context><context>virtual host</context>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<context>directory</context><context>.htaccess</context></contextlist>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The <directive>RewriteEngine</directive> directive enables or
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive disables the runtime rewriting engine. If it is set to
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <code>off</code> this module does no runtime processing at
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive all. It does not even update the <code>SCRIPT_URx</code>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive environment variables.</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>Use this directive to disable the module instead of
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive commenting out all the <directive
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive module="mod_rewrite">RewriteRule</directive> directives!</p>
4c36c711036219c80d5517d35be68a4769c15291slive <p>Note that rewrite configurations are not
4c36c711036219c80d5517d35be68a4769c15291slive inherited by virtual hosts. This means that you need to have a
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <code>RewriteEngine on</code> directive for each virtual host
4c36c711036219c80d5517d35be68a4769c15291slive in which you wish to use rewrite rules.</p>
fc9f416faa11879811f17d6efadedbf81cfd52a1covener <p><directive>RewriteMap</directive> directives of the type <code>prg</code>
fc9f416faa11879811f17d6efadedbf81cfd52a1covener are not started during server initialization if they're defined in a
fc9f416faa11879811f17d6efadedbf81cfd52a1covener context that does not have <directive>RewriteEngine</directive> set to
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<description>Sets some special options for the rewrite engine</description>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<contextlist><context>server config</context><context>virtual host</context>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<context>directory</context><context>.htaccess</context></contextlist>
1d7d4ad3081da9e2bc11611ddccdf68f89e8baf9nd<compatibility><code>MaxRedirects</code> is no longer available in version 2.1 and
9ed9ba1fcf0a4a39f78f5f809c661bbd590b70eandlater</compatibility>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The <directive>RewriteOptions</directive> directive sets some
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive special options for the current per-server or per-directory
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor configuration. The <em>Option</em> string can currently
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin only be one of the following:</p>
9ed9ba1fcf0a4a39f78f5f809c661bbd590b70eand <dd>This forces the current configuration to inherit the
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin configuration of the parent. In per-virtual-server context,
9ed9ba1fcf0a4a39f78f5f809c661bbd590b70eand this means that the maps, conditions and rules of the main
9ed9ba1fcf0a4a39f78f5f809c661bbd590b70eand server are inherited. In per-directory context this means
9ed9ba1fcf0a4a39f78f5f809c661bbd590b70eand that conditions and rules of the parent directory's
a4d04b8c74044c58bd4182028a1408d936c95951covener <directive type="section" module="core">Directory</directive>
a4d04b8c74044c58bd4182028a1408d936c95951covener sections are inherited. The inherited rules are virtually copied
a4d04b8c74044c58bd4182028a1408d936c95951covener to the section where this directive is being used. If used in
a4d04b8c74044c58bd4182028a1408d936c95951covener combination with local rules, the inherited rules are copied behind
a4d04b8c74044c58bd4182028a1408d936c95951covener the local rules. The position of this directive - below or above
a4d04b8c74044c58bd4182028a1408d936c95951covener of local rules - has no influence on this behavior. If local
a4d04b8c74044c58bd4182028a1408d936c95951covener rules forced the rewriting to stop, the inherited rules won't
a4d04b8c74044c58bd4182028a1408d936c95951covener be processed.</dd>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<description>Defines a mapping function for key-lookup</description>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<syntax>RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<contextlist><context>server config</context><context>virtual host</context>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</contextlist>
630c456b6461158be6cc5c5483735e27b13b4ad5nd<compatibility>The choice of different dbm types is available in
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowenApache HTTP Server 2.0.41 and later</compatibility>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The <directive>RewriteMap</directive> directive defines a
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive substitution strings by the mapping-functions to
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive insert/substitute fields through a key lookup. The source of
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive this lookup can be of various types.</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive the name of the map and will be used to specify a
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive mapping-function for the substitution strings of a rewriting
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive rule via one of the following constructs:</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <strong><code>${</code> <em>MapName</em> <code>:</code>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <em>LookupKey</em> <code>|</code> <em>DefaultValue</em>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <p>When such a construct occurs, the map <em>MapName</em> is
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive consulted and the key <em>LookupKey</em> is looked-up. If the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive key is found, the map-function construct is substituted by
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <em>SubstValue</em>. If the key is not found then it is
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive substituted by <em>DefaultValue</em> or by the empty string
ee73c32ad65734a6514bcbd0ed6e20494e8a50bdrbowen <p>For example, you might define a
ee73c32ad65734a6514bcbd0ed6e20494e8a50bdrbowen <p>You would then be able to use this map in a
8ac3ff7008df949c096f9cd8f769c7893594f61fnd RewriteRule ^/ex/(.*) ${examplemap:$1}
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The following combinations for <em>MapType</em> and
790a477f6ce41161c4173c1e5080a1f569976a1erbowen <dd>A plain text file containing space-separated key-value
790a477f6ce41161c4173c1e5080a1f569976a1erbowen pairs, one per line. (<a href="/rewrite/rewritemap.html#txt">Details ...</a>)</dd>
790a477f6ce41161c4173c1e5080a1f569976a1erbowen <dd>Randomly selects an entry from a plain text file (<a href="/rewrite/rewritemap.html#rnd">Details ...</a>)</dd>
790a477f6ce41161c4173c1e5080a1f569976a1erbowen <dd>Looks up an entry in a dbm file containing name, value
0a3142725875ea286597e083547d34d98f8c1f2drbowen pairs. Hash is constructed from a plain text file format using
0a3142725875ea286597e083547d34d98f8c1f2drbowen the <code><a href="/programs/httxt2dbm.html">httxt2dbm</a></code>
790a477f6ce41161c4173c1e5080a1f569976a1erbowen utility. (<a href="/rewrite/rewritemap.html#dbm">Details ...</a>)</dd>
790a477f6ce41161c4173c1e5080a1f569976a1erbowen <dd>One of the four available internal functions provided by
790a477f6ce41161c4173c1e5080a1f569976a1erbowen unescape. (<a href="/rewrite/rewritemap.html#int">Details ...</a>)</dd>
790a477f6ce41161c4173c1e5080a1f569976a1erbowen <dd>Calls an external program or script to process the
790a477f6ce41161c4173c1e5080a1f569976a1erbowen rewriting. (<a href="/rewrite/rewritemap.html#prg">Details ...</a>)</dd>
790a477f6ce41161c4173c1e5080a1f569976a1erbowen <dd>A SQL SELECT statement to be performed to look up the
790a477f6ce41161c4173c1e5080a1f569976a1erbowen rewrite target. (<a href="/rewrite/rewritemap.html#dbd">Details ...</a>)</dd>
0a3142725875ea286597e083547d34d98f8c1f2drbowen <p>Further details, and numerous examples, may be found in the <a
0a3142725875ea286597e083547d34d98f8c1f2drbowen href="/rewrite/rewritemap.html">RewriteMap HowTo</a></p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<description>Sets the base URL for per-directory rewrites</description>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<contextlist><context>directory</context><context>.htaccess</context>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</contextlist>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The <directive>RewriteBase</directive> directive explicitly
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener sets the base URL-path (not filesystem directory path!) for per-directory rewrites.
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin When you use a <directive module="mod_rewrite">RewriteRule</directive>
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin in a <code>.htaccess</code> file, <module>mod_rewrite</module> strips off
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin the local directory prefix before processing, then rewrites the rest of
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin the URL. When the rewrite is completed, <module>mod_rewrite</module>
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin automatically adds the local directory prefix back on to the path.</p>
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener <p>This directive is <em>required</em> for per-directory rewrites whose context
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener is a directory made available via the <directive module="mod_alias">Alias</directive>
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener directive.</p>
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener <p>If your URL path does not exist verbatim on the filesystem,
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener or isn't directly under your <directive module="core">DocumentRoot</directive>,
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin you must use <directive>RewriteBase</directive> in every
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin <code>.htaccess</code> file where you want to use <directive
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener module="mod_rewrite">RewriteRule</directive> directives.</p>
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirin <p>The example below demonstrates how to map
fa0f379e3845907d7c1087d885169e302239bdbbnd /home/www/example/newsite.html, in a <code>.htaccess</code> file. This
fa0f379e3845907d7c1087d885169e302239bdbbnd assumes that the content available at
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteEngine On
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovener# The URL-path used to get to this context, not the filesystem path
25d988d92af8cf0d997aa1ebbc7cb11daa14d0becovenerRewriteBase /myapp/
635de20c16ef862bfc5b0d5f9ceb40ebeaddfdf3noirinRewriteRule ^index\.html$ newsite.html
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<description>Defines a condition under which rewriting will take place
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</description>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<syntax> RewriteCond
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<contextlist><context>server config</context><context>virtual host</context>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<context>directory</context><context>.htaccess</context></contextlist>
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>The <directive>RewriteCond</directive> directive defines a
fa0f379e3845907d7c1087d885169e302239bdbbnd rule condition. One or more <directive>RewriteCond</directive>
fa0f379e3845907d7c1087d885169e302239bdbbnd can precede a <directive module="mod_rewrite">RewriteRule</directive>
fa0f379e3845907d7c1087d885169e302239bdbbnd directive. The following rule is then only used if both
fa0f379e3845907d7c1087d885169e302239bdbbnd the current state of the URI matches its pattern, <strong
fa0f379e3845907d7c1087d885169e302239bdbbnd following expanded constructs in addition to plain text:</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <strong>RewriteRule backreferences</strong>: These are
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin backreferences of the form <strong><code>$N</code></strong>
b115299831a7b4bbec58a88d708d8536e1ecd50csf (0 <= N <= 9). $1 to $9 provide access to the grouped
fa0f379e3845907d7c1087d885169e302239bdbbnd parts (in parentheses) of the pattern, from the
b115299831a7b4bbec58a88d708d8536e1ecd50csf access to the whole string matched by that pattern.
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <strong>RewriteCond backreferences</strong>: These are
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin backreferences of the form <strong><code>%N</code></strong>
b115299831a7b4bbec58a88d708d8536e1ecd50csf (0 <= N <= 9). %1 to %9 provide access to the grouped
fa0f379e3845907d7c1087d885169e302239bdbbnd parts (again, in parentheses) of the pattern, from the last matched
b115299831a7b4bbec58a88d708d8536e1ecd50csf of conditions. %0 provides access to the whole string matched by
b115299831a7b4bbec58a88d708d8536e1ecd50csf that pattern.
fa0f379e3845907d7c1087d885169e302239bdbbnd RewriteMap</a> for more details.
fa0f379e3845907d7c1087d885169e302239bdbbnd <strong>Server-Variables</strong>: These are variables of
fa0f379e3845907d7c1087d885169e302239bdbbnd from the following list:
97a9a944b5887e91042b019776c41d5dd74557aferikabele <th>HTTP headers:</th> <th>connection & request:</th> <th></th>
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi HTTP_USER_AGENT<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive HTTP_REFERER<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive HTTP_COOKIE<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive HTTP_FORWARDED<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive HTTP_HOST<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive HTTP_PROXY_CONNECTION<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive HTTP_ACCEPT<br />
97a9a944b5887e91042b019776c41d5dd74557aferikabele REMOTE_ADDR<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive REMOTE_HOST<br />
74a6de79356cd15d2e47065087785e36dd65aa41nd REMOTE_PORT<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive REMOTE_USER<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive REMOTE_IDENT<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive REQUEST_METHOD<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SCRIPT_FILENAME<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive PATH_INFO<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive QUERY_STRING<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive AUTH_TYPE<br />
53d2fd50ff45e7c568f0588c742a5ef9edf8e275rbowen <th>server internals:</th> <th>date and time:</th> <th>specials:</th>
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi DOCUMENT_ROOT<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SERVER_ADMIN<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SERVER_NAME<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SERVER_ADDR<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SERVER_PORT<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SERVER_PROTOCOL<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive SERVER_SOFTWARE<br />
97a9a944b5887e91042b019776c41d5dd74557aferikabele TIME_YEAR<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive TIME_MON<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive TIME_DAY<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive TIME_HOUR<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive TIME_MIN<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive TIME_SEC<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive TIME_WDAY<br />
97a9a944b5887e91042b019776c41d5dd74557aferikabele API_VERSION<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive THE_REQUEST<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive REQUEST_URI<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive REQUEST_FILENAME<br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive IS_SUBREQ<br />
fb82af0f0cd7b58eef19c54b086131b7e1e1e749madhum HTTPS<br />
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>These variables all
fa0f379e3845907d7c1087d885169e302239bdbbnd correspond to the similarly named HTTP
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen MIME-headers, C variables of the Apache HTTP Server or
fa0f379e3845907d7c1087d885169e302239bdbbnd Most are documented elsewhere in the Manual or in
fa0f379e3845907d7c1087d885169e302239bdbbnd the CGI specification. Those that are special to
fa0f379e3845907d7c1087d885169e302239bdbbnd mod_rewrite include those below.</p>
fa0f379e3845907d7c1087d885169e302239bdbbnd <dd>Will contain the text "true" if the request
fa0f379e3845907d7c1087d885169e302239bdbbnd currently being processed is a sub-request,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive "false" otherwise. Sub-requests may be generated
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive by modules that need to resolve additional files
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive or URIs in order to complete their tasks.</dd>
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen <dd>This is the version of the Apache httpd module API
fa0f379e3845907d7c1087d885169e302239bdbbnd (the internal interface between server and
fa0f379e3845907d7c1087d885169e302239bdbbnd module) in the current httpd build, as defined in
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen corresponds to the version of Apache httpd in use (in
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen the release version of Apache httpd 1.3.14, for
fa0f379e3845907d7c1087d885169e302239bdbbnd instance, it is 19990320:10), but is mainly of
fa0f379e3845907d7c1087d885169e302239bdbbnd interest to module authors.</dd>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <dd>The full HTTP request line sent by the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive include any additional headers sent by the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive browser.</dd>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <dd>The resource requested in the HTTP request
fa0f379e3845907d7c1087d885169e302239bdbbnd line. (In the example above, this would be
fa0f379e3845907d7c1087d885169e302239bdbbnd <dd>The full local filesystem path to the file or
c0a201f9f0cda37f4e5829462c7e489f85bf327ccovener script matching the request, if this has already
c0a201f9f0cda37f4e5829462c7e489f85bf327ccovener been determined by the server at the time
c0a201f9f0cda37f4e5829462c7e489f85bf327ccovener <code>REQUEST_FILENAME</code> is referenced. Otherwise,
c0a201f9f0cda37f4e5829462c7e489f85bf327ccovener such as when used in virtual host context, the same
fa0f379e3845907d7c1087d885169e302239bdbbnd <dd>Will contain the text "on" if the connection is
fa0f379e3845907d7c1087d885169e302239bdbbnd can be safely used regardless of whether or not
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>The variables SCRIPT_FILENAME and REQUEST_FILENAME
fa0f379e3845907d7c1087d885169e302239bdbbnd contain the same value - the value of the
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen <code>request_rec</code> structure of the Apache HTTP Server.
fa0f379e3845907d7c1087d885169e302239bdbbnd The first name is the commonly known CGI variable name
fa0f379e3845907d7c1087d885169e302239bdbbnd while the second is the appropriate counterpart of
fa0f379e3845907d7c1087d885169e302239bdbbnd REQUEST_URI (which contains the value of the
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>If a substitution occurred and the rewriting continues,
fa0f379e3845907d7c1087d885169e302239bdbbnd the value of both variables will be updated accordingly.</p>
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>If used in per-server context (<em>i.e.</em>, before the
fa0f379e3845907d7c1087d885169e302239bdbbnd request is mapped to the filesystem) SCRIPT_FILENAME and
fa0f379e3845907d7c1087d885169e302239bdbbnd REQUEST_FILENAME cannot contain the full local filesystem
fa0f379e3845907d7c1087d885169e302239bdbbnd path since the path is unknown at this stage of processing.
fa0f379e3845907d7c1087d885169e302239bdbbnd Both variables will initially contain the value of REQUEST_URI
fa0f379e3845907d7c1087d885169e302239bdbbnd in that case. In order to obtain the full local filesystem
fa0f379e3845907d7c1087d885169e302239bdbbnd path of the request in per-server context, use an URL-based
a4d04b8c74044c58bd4182028a1408d936c95951covener look-ahead <code>%{LA-U:REQUEST_FILENAME}</code> to determine
fa0f379e3845907d7c1087d885169e302239bdbbnd <code>%{ENV:variable}</code>, where <em>variable</em> can be
fa0f379e3845907d7c1087d885169e302239bdbbnd any environment variable, is also available.
fa0f379e3845907d7c1087d885169e302239bdbbnd This is looked-up via internal
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen Apache httpd structures and (if not found there) via
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen <code>getenv()</code> from the Apache httpd server process.</li>
fa0f379e3845907d7c1087d885169e302239bdbbnd <code>%{SSL:variable}</code>, where <em>variable</em> is the
7748a5c411233f9e1f3df10ea5fffffa91e58824jorton name of an <a href="mod_ssl.html#envvars">SSL environment
fa0f379e3845907d7c1087d885169e302239bdbbnd variable</a>, can be used whether or not
fa0f379e3845907d7c1087d885169e302239bdbbnd <module>mod_ssl</module> is loaded, but will always expand to
fa0f379e3845907d7c1087d885169e302239bdbbnd the empty string if it is not. Example:
fa0f379e3845907d7c1087d885169e302239bdbbnd <code>%{HTTP:header}</code>, where <em>header</em> can be
fa0f379e3845907d7c1087d885169e302239bdbbnd any HTTP MIME-header name, can always be used to obtain the
fa0f379e3845907d7c1087d885169e302239bdbbnd value of a header sent in the HTTP request.
fa0f379e3845907d7c1087d885169e302239bdbbnd the value of the HTTP header
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>If a HTTP header is used in a condition this header is added to
fa0f379e3845907d7c1087d885169e302239bdbbnd the Vary header of the response in case the condition evaluates to
fa0f379e3845907d7c1087d885169e302239bdbbnd to true for the request. It is <strong>not</strong> added if the
fa0f379e3845907d7c1087d885169e302239bdbbnd condition evaluates to false for the request. Adding the HTTP header
fa0f379e3845907d7c1087d885169e302239bdbbnd to the Vary header of the response is needed for proper caching.</p>
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>It has to be kept in mind that conditions follow a short circuit
fa0f379e3845907d7c1087d885169e302239bdbbnd logic in the case of the '<strong><code>ornext|OR</code></strong>' flag
fa0f379e3845907d7c1087d885169e302239bdbbnd so that certain conditions might not be evaluated at all.</p></li>
fa0f379e3845907d7c1087d885169e302239bdbbnd <code>%{LA-U:variable}</code> can be used for look-aheads which perform
fa0f379e3845907d7c1087d885169e302239bdbbnd an internal (URL-based) sub-request to determine the final
fa0f379e3845907d7c1087d885169e302239bdbbnd variable for rewriting which is not available at the current
fa0f379e3845907d7c1087d885169e302239bdbbnd stage, but will be set in a later phase.
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>For instance, to rewrite according to the
fa0f379e3845907d7c1087d885169e302239bdbbnd per-server context (<code>httpd.conf</code> file) you must
fa0f379e3845907d7c1087d885169e302239bdbbnd variable is set by the authorization phases, which come
fa0f379e3845907d7c1087d885169e302239bdbbnd <em>after</em> the URL translation phase (during which mod_rewrite
fa0f379e3845907d7c1087d885169e302239bdbbnd operates).</p>
fa0f379e3845907d7c1087d885169e302239bdbbnd <p>On the other hand, because mod_rewrite implements
fa0f379e3845907d7c1087d885169e302239bdbbnd its per-directory context (<code>.htaccess</code> file) via
fa0f379e3845907d7c1087d885169e302239bdbbnd the Fixup phase of the API and because the authorization
fa0f379e3845907d7c1087d885169e302239bdbbnd <code>%{LA-F:variable}</code> can be used to perform an internal
fa0f379e3845907d7c1087d885169e302239bdbbnd (filename-based) sub-request, to determine the final value
fa0f379e3845907d7c1087d885169e302239bdbbnd of <em>variable</em>. Most of the time, this is the same as
fa0f379e3845907d7c1087d885169e302239bdbbnd LA-U above.</li>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin a regular expression which is applied to the
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <em>TestString</em> is first evaluated, before being matched against
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p><strong>Remember:</strong> <em>CondPattern</em> is a
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive additions:</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <li>You can prefix the pattern string with a
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive '<code>!</code>' character (exclamation mark) to specify a
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive There are some special variants of <em>CondPatterns</em>.
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive Instead of real regular expression strings you can also
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor use one of the following:
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor <li>'<strong><CondPattern</strong>' (lexicographically
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi precedes)<br />
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Treats the <em>CondPattern</em> as a plain string and
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin compares it lexicographically to <em>TestString</em>. True if
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <li>'<strong>>CondPattern</strong>' (lexicographically
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin follows)<br />
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Treats the <em>CondPattern</em> as a plain string and
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin compares it lexicographically to <em>TestString</em>. True if
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <li>'<strong>=CondPattern</strong>' (lexicographically
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive equal)<br />
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Treats the <em>CondPattern</em> as a plain string and
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin compares it lexicographically to <em>TestString</em>. True if
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin equal, character for character). If <em>CondPattern</em>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive compares <em>TestString</em> to the empty string.</li>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive Treats the <em>TestString</em> as a pathname and tests
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin whether or not it exists, and is a directory.</li>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive Treats the <em>TestString</em> as a pathname and tests
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin whether or not it exists, and is a regular file.</li>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Treats the <em>TestString</em> as a pathname and tests
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin whether or not it exists, and is a regular file with size greater
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive than zero.</li>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Treats the <em>TestString</em> as a pathname and tests
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin whether or not it exists, and is a symbolic link.</li>
4e3cdb85620921a8a120fe22edbccae708f4f34end <li>'<strong>-x</strong>' (has e<strong>x</strong>ecutable
4e3cdb85620921a8a120fe22edbccae708f4f34end permissions)<br />
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor whether or not it exists, and has executable permissions.
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor These permissions are determined according to
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi the underlying OS.</li>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive subrequest)<br />
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Checks whether or not <em>TestString</em> is a valid file,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive accessible via all the server's currently-configured
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive access controls for that path. This uses an internal
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin subrequest to do the check, so use it with care -
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin it can impact your server's performance!</li>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive subrequest)<br />
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Checks whether or not <em>TestString</em> is a valid URL,
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive accessible via all the server's currently-configured
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive access controls for that path. This uses an internal
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor subrequest to do the check, so use it with care -
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin it can impact your server's performance!</li>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive All of these tests can
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive also be prefixed by an exclamation mark ('!') to
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive negate their meaning.
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi <li>You can also set special flags for
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <strong><code>[</code><em>flags</em><code>]</code></strong>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin as the third argument to the <code>RewriteCond</code>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin directive, where <em>flags</em> is a comma-separated list of any of the
5a4ba75a85817ca324e4f054d56f42a6a14adc5dnd following flags:
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor This makes the test case-insensitive - differences
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi between 'A-Z' and 'a-z' are ignored, both in the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive expanded <em>TestString</em> and the <em>CondPattern</em>.
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive This flag is effective only for comparisons between
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <em>TestString</em> and <em>CondPattern</em>. It has no
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive effect on filesystem and subrequest checks.</li>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Use this to combine rule conditions with a local OR
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor instead of the implicit AND. Typical example:
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteCond %{REMOTE_HOST} ^host1.* [OR]
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteCond %{REMOTE_HOST} ^host2.* [OR]
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteCond %{REMOTE_HOST} ^host3.*
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteRule ...some special stuff for any of these hosts...
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin Without this flag you would have to write the condition/rule
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin pair three times.
b65a184929c97d0b0e4d3bad42648e0e9ce1b8ferpluem If a HTTP header is used in the condition, this flag prevents
b65a184929c97d0b0e4d3bad42648e0e9ce1b8ferpluem this header from being added to the Vary header of the response. <br />
b65a184929c97d0b0e4d3bad42648e0e9ce1b8ferpluem Using this flag might break proper caching of the response if
b65a184929c97d0b0e4d3bad42648e0e9ce1b8ferpluem the representation of this response varies on the value of this header.
b65a184929c97d0b0e4d3bad42648e0e9ce1b8ferpluem So this flag should be only used if the meaning of the Vary header
b65a184929c97d0b0e4d3bad42648e0e9ce1b8ferpluem is well understood.
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>To rewrite the Homepage of a site according to the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive ``<code>User-Agent:</code>'' header of the request, you can
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive use the following: </p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteCond %{HTTP_USER_AGENT} ^Mozilla.*
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteRule ^/$ /homepage.max.html [L]
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteCond %{HTTP_USER_AGENT} ^Lynx.*
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteRule ^/$ /homepage.min.html [L]
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveRewriteRule ^/$ /homepage.std.html [L]
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor <p>Explanation: If you use a browser which identifies itself
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi as 'Mozilla' (including Netscape Navigator, Mozilla etc), then you
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin get the max homepage (which could include frames, or other special
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin If you use the Lynx browser (which is terminal-based), then
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor you get the min homepage (which could be a version designed for
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi easy, text-only browsing).
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi If neither of these conditions apply (you use any other browser,
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi or your browser identifies itself as something non-standard), you get
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin the std (standard) homepage.</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<description>Defines rules for the rewriting engine</description>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<syntax>RewriteRule
96147932f199be4ad038778e702c13a2f79051c0slive <em>Pattern</em> <em>Substitution</em> [<em>flags</em>]</syntax>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<contextlist><context>server config</context><context>virtual host</context>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<context>directory</context><context>.htaccess</context></contextlist>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <p>The <directive>RewriteRule</directive> directive is the real
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor rewriting workhorse. The directive can occur more than once,
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin with each instance defining a single rewrite rule. The
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin order in which these rules are defined is important - this is the order
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin in which they will be applied at run-time.</p>
630c456b6461158be6cc5c5483735e27b13b4ad5nd <p><a id="patterns" name="patterns"><em>Pattern</em></a> is
a4d04b8c74044c58bd4182028a1408d936c95951covener expression</a>. On the first RewriteRule it is applied to the (%-encoded)
8c8c2e71c84babf0e8c4b35819c7c5b3be014cfenoodl <a href="/directive-dict.html#Syntax">URL-path</a> of the request;
8c8c2e71c84babf0e8c4b35819c7c5b3be014cfenoodl subsequent patterns are applied to the output of the last matched
8c8c2e71c84babf0e8c4b35819c7c5b3be014cfenoodl RewriteRule.</p>
96147932f199be4ad038778e702c13a2f79051c0slive <p>The <em>Pattern</em> will initially be matched against the part of the
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener URL after the hostname and port, and before the query string.</p>
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener <p>When the RewriteRule appears in per-directory (htaccess) context, the
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener <em>Pattern</em> is matched against what remains of the URL after removing
cea021a7fc2657b091df4d3b031c4254ec371dd7rbowen the prefix that lead Apache httpd to the current rules (see the
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener <directive module="mod_rewrite">RewriteBase</directive>). The removed prefix
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener always ends with a slash, meaning the matching occurs against a string which
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener never has a leading slash. A <em>Pattern</em> with <code>^/</code> never
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener matches in per-directory context.</p>
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener <p>If you wish to match against the hostname, port, or query string, use a
96147932f199be4ad038778e702c13a2f79051c0slive <directive module="mod_rewrite">RewriteCond</directive> with the
96147932f199be4ad038778e702c13a2f79051c0slive <code>%{HTTP_HOST}</code>, <code>%{SERVER_PORT}</code>, or
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener <code>%{QUERY_STRING}</code> variables respectively. If you wish to
e619b7228ac42d9c70d6a5f02d808b0d2880080ccovener match against the full URL-path in a per-directory (htaccess) RewriteRule,
70f2730533c8592263435354e66d9dbaf4d6361bslive expressions</glossary>, see
206b5dce9e48924aa9f12ce87f14856a4cd3fb68takashi <p>In mod_rewrite, the NOT character
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor ('<code>!</code>') is also available as a possible pattern
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin prefix. This enables you to negate a pattern; to say, for instance:
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive ``<em>if the current URL does <strong>NOT</strong> match this
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive pattern</em>''. This can be used for exceptional cases, where
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive it is easier to match the negative pattern, or as a last
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive default rule.</p>
5f18f92c1354462df6dc2ba38277a953fa700b13gryzorWhen using the NOT character to negate a pattern, you cannot include
5f18f92c1354462df6dc2ba38277a953fa700b13gryzorgrouped wildcard parts in that pattern. This is because, when the
5f18f92c1354462df6dc2ba38277a953fa700b13gryzorpattern does NOT match (ie, the negation matches), there are no
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirincontents for the groups. Thus, if negated patterns are used, you
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirincannot use <code>$N</code> in the substitution string!
96147932f199be4ad038778e702c13a2f79051c0slive <p>The <a id="rhs" name="rhs"><em>Substitution</em></a> of a
96147932f199be4ad038778e702c13a2f79051c0slive rewrite rule is the string that replaces the original URL-path that
96147932f199be4ad038778e702c13a2f79051c0slive was matched by <em>Pattern</em>. The <em>Substitution</em> may
96147932f199be4ad038778e702c13a2f79051c0slive <dd>Designates the location on the file-system of the resource
96147932f199be4ad038778e702c13a2f79051c0slive to be delivered to the client.</dd>
96147932f199be4ad038778e702c13a2f79051c0slive module="core">DocumentRoot</directive>-relative path to the
96147932f199be4ad038778e702c13a2f79051c0slive resource to be served. Note that <module>mod_rewrite</module>
96147932f199be4ad038778e702c13a2f79051c0slive tries to guess whether you have specified a file-system path
45309cf90ecc60d20e1ac810881e7b149fbe4e35noodl or a URL-path by checking to see if the first segment of the
96147932f199be4ad038778e702c13a2f79051c0slive path exists at the root of the file-system. For example, if
96147932f199be4ad038778e702c13a2f79051c0slive <code>/www/file.html</code>, then this will be treated as a
96147932f199be4ad038778e702c13a2f79051c0slive URL-path <em>unless</em> a directory named <code>www</code>
96147932f199be4ad038778e702c13a2f79051c0slive exists at the root or your file-system, in which case it will
96147932f199be4ad038778e702c13a2f79051c0slive be treated as a file-system path. If you wish other
96147932f199be4ad038778e702c13a2f79051c0slive URL-mapping directives (such as <directive
96147932f199be4ad038778e702c13a2f79051c0slive module="mod_alias">Alias</directive>) to be applied to the
96147932f199be4ad038778e702c13a2f79051c0slive described below.</dd>
96147932f199be4ad038778e702c13a2f79051c0slive <dd>If an absolute URL is specified,
96147932f199be4ad038778e702c13a2f79051c0slive <module>mod_rewrite</module> checks to see whether the
96147932f199be4ad038778e702c13a2f79051c0slive hostname matches the current host. If it does, the scheme and
96147932f199be4ad038778e702c13a2f79051c0slive hostname are stripped out and the resulting path is treated as
96147932f199be4ad038778e702c13a2f79051c0slive a URL-path. Otherwise, an external redirect is performed for
96147932f199be4ad038778e702c13a2f79051c0slive the given URL. To force an external redirect back to the
96147932f199be4ad038778e702c13a2f79051c0slive current host, see the <code>[R]</code> flag below.</dd>
96147932f199be4ad038778e702c13a2f79051c0slive <dd>A dash indicates that no substitution should be performed
96147932f199be4ad038778e702c13a2f79051c0slive (the existing path is passed through untouched). This is used
96147932f199be4ad038778e702c13a2f79051c0slive when a flag (see below) needs to be applied without changing
96147932f199be4ad038778e702c13a2f79051c0slive the path.</dd>
96147932f199be4ad038778e702c13a2f79051c0slive <p>In addition to plain text, the <em>Substition</em> string can include</p>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <li>back-references (<code>$N</code>) to the RewriteRule
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive pattern</li>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <li>back-references (<code>%N</code>) to the last matched
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive RewriteCond pattern</li>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <li>server-variables as in rule condition test-strings
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor <p>Back-references are identifiers of the form
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive by the contents of the <strong>N</strong>th group of the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive matched <em>Pattern</em>. The server-variables are the same
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive as for the <em>TestString</em> of a <code>RewriteCond</code>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive directive. The mapping-functions come from the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive <code>RewriteMap</code> directive and are explained there.
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin These three types of variables are expanded in the order above.</p>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <p>As already mentioned, all rewrite rules are
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor applied to the <em>Substitution</em> (in the order in which
4bf4c38816cd24dab6fee4884ee98b58011cb6a5noirin they are defined
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin in the config file). The URL is <strong>completely
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive replaced</strong> by the <em>Substitution</em> and the
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin rewriting process continues until all rules have been applied,
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin or it is explicitly terminated by a
96147932f199be4ad038778e702c13a2f79051c0slive <p>By default, the query string is passed through unchanged. You
96147932f199be4ad038778e702c13a2f79051c0slive can, however, create URLs in the substitution string containing
96147932f199be4ad038778e702c13a2f79051c0slive a query string part. Simply use a question mark inside the
96147932f199be4ad038778e702c13a2f79051c0slive substitution string to indicate that the following text should
96147932f199be4ad038778e702c13a2f79051c0slive be re-injected into the query string. When you want to erase an
96147932f199be4ad038778e702c13a2f79051c0slive existing query string, end the substitution string with just a
96147932f199be4ad038778e702c13a2f79051c0slive question mark. To combine new and old query strings, use the
21f4ac5ab80abe4cbe90ae0f340c29053556c52drbowen <p>Additionally you can set special <a name="rewriteflags"
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin appending <strong><code>[</code><em>flags</em><code>]</code></strong>
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor directive. <em>Flags</em> is a comma-separated list, surround by square
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen brackets, of any of the flags in the following table. More
2f44538c88c5310bebb17a39b171487315a45624lgentis details, and examples, for each flag, are available in the <a
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html">Rewrite Flags document</a>.</p>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Escape non-alphanumeric characters <em>before</em> applying
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_b">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Rule is chained to the following rule. If the rule fails,
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_c">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Sets a cookie in the client browser. Full syntax is:
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen CO=<em>NAME</em>:<em>VAL</em>[:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>[:<em>secure</em>[:<em>httponly</em>]]]]] <em><a href="/rewrite/flags.html#flag_co">details ...</a></em>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Causes the PATH_INFO portion of the rewritten URI to be
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen discarded. <em><a href="/rewrite/flags.html#flag_dpi">details
39d67f66729a7008c1e73d65a81e778ce819a227rjung <td>Causes an environment variable <em>VAR</em> to be set (to the
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_e">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Returns a 403 FORBIDDEN response to the client browser.
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <em><a href="/rewrite/flags.html#flag_f">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Returns a 410 GONE response to the client browser. <em><a
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_g">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Causes the resulting URI to be sent to the specified
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_h">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Stop the rewriting process immediately and don't apply any
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen more rules. Especially note caveats for per-directory and
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_l">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Re-run the rewriting process, starting again with the first
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen rule, using the result of the ruleset so far as a starting
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen point. <em><a href="/rewrite/flags.html#flag_n">details
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Makes the pattern pattern comparison case-insensitive.
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <em><a href="/rewrite/flags.html#flag_nc">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Prevent mod_rewrite from applying hexcode escaping of
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen special characters in the result of the rewrite. <em><a
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_ne">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Causes a rule to be skipped if the current request is an
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_ns">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Force the substitution URL to be internally sent as a proxy
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen request. <em><a href="/rewrite/flags.html#flag_p">details
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Forces the resulting URI to be passed back to the URL
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen mapping engine for processing of other URI-to-filename
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_pt">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Appends any query string created in the rewrite target to
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen any query string that was in the original request URL. <em><a
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_qsa">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Discard any query string attached to the incoming URI.
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Forces an external redirect, optionally with the specified
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_r">details ...</a></em>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Tells the rewriting engine to skip the next <em>num</em>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_s">details ...</a></em></td>
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen <td>Force the <glossary>MIME-type</glossary> of the target file
ee9cda8f648f99a0b889cb0831ba5b1efe6b3eb5rbowen href="/rewrite/flags.html#flag_t">details ...</a></em></td>
de68ca33425122cf4a880859013e08e84f8143a5covener<p> When the substitution string begins with a string
de68ca33425122cf4a880859013e08e84f8143a5covenerresembling "/~user" (via explicit text or backreferences), mod_rewrite performs
5f18f92c1354462df6dc2ba38277a953fa700b13gryzorhome directory expansion independent of the presence or configuration
de68ca33425122cf4a880859013e08e84f8143a5covener<p> This expansion does not occur when the <em>PT</em>
de68ca33425122cf4a880859013e08e84f8143a5covenerflag is used on the <directive module="mod_rewrite">RewriteRule</directive>
de68ca33425122cf4a880859013e08e84f8143a5covenerdirective.</p>
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivehref="/howto/htaccess.html">.htaccess</a> files. To enable the
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcsliverewrite engine for these files you need to set
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslive"<code>Options FollowSymLinks</code>" must be enabled. If your
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcsliveadministrator has disabled override of <code>FollowSymLinks</code> for
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivea user's directory, then you cannot use the rewrite engine. This
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcsliverestriction is required for security reasons.</p>
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslive<p>When using the rewrite engine in <code>.htaccess</code> files the
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveper-directory prefix (which always is the same for a specific
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirindirectory) is automatically <em>removed</em> for the pattern matching
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfsliveand automatically <em>added</em> after the substitution has been
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivedone. This feature is essential for many sorts of rewriting; without
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivethis, you would always have to match the parent directory, which is
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivenot always possible. There is one exception: If a substitution string
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivestarts with <code>http://</code>, then the directory prefix will
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslive<strong>not</strong> be added, and an external redirect (or proxy
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivethroughput, if using flag <strong>P</strong>) is forced. See the
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslive<directive module="mod_rewrite">RewriteBase</directive> directive for
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivemore information.</p>
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslive<p>The rewrite engine may also be used in <directive type="section"
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivemodule="core">Directory</directive> sections with the same
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcsliveprefix-matching rules as would be applied to <code>.htaccess</code>
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivefiles. It is usually simpler, however, to avoid the prefix substitution
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivecomplication by putting the rewrite rules in the main server or
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslivevirtual host context, rather than in a <directive type="section"
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcslive<p>Although rewrite rules are syntactically permitted in <directive
a4d04b8c74044c58bd4182028a1408d936c95951covenertype="section" module="core">Location</directive> and <directive
a4d04b8c74044c58bd4182028a1408d936c95951covenertype="section" module="core">Files</directive> sections, this
e9d3697fa9387adc0cc9a61b0c3ca75edfb83abcsliveshould never be necessary and is unsupported.</p>
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin <p>Here are all possible substitution combinations and their
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive meanings:</p>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive for request ``<code>GET
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<strong>Given Rule</strong> <strong>Resulting Substitution</strong>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^/somepath(.*) otherpath$1 invalid, not supported
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^/somepath(.*) otherpath$1 [R] invalid, not supported
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^/somepath(.*) otherpath$1 [P] invalid, not supported
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^/somepath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^/somepath(.*) /otherpath$1 [P] doesn't make sense, not supported
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^/somepath(.*) http://thishost/otherpath$1 /otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^/somepath(.*) http://thishost/otherpath$1 [R] http://thishost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^/somepath(.*) http://thishost/otherpath$1 [P] doesn't make sense, not supported
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^/somepath(.*) http://otherhost/otherpath$1 http://otherhost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^/somepath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive (the [R] flag is redundant)
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via internal proxy
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin (<code>/physical/path/to/somepath/.htacccess</code>, with
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive for request ``<code>GET
5f18f92c1354462df6dc2ba38277a953fa700b13gryzor /somepath/localpath/pathinfo</code>'':</strong><br />
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive<strong>Given Rule</strong> <strong>Resulting Substitution</strong>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) otherpath$1 /somepath/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) otherpath$1 [R] http://thishost/somepath/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^localpath(.*) otherpath$1 [P] doesn't make sense, not supported
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^localpath(.*) /otherpath$1 [P] doesn't make sense, not supported
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) http://thishost/otherpath$1 /otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) http://thishost/otherpath$1 [R] http://thishost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
b1136023d7083e8ada7ee2a7f8563383568d0e9cnoirin^localpath(.*) http://thishost/otherpath$1 [P] doesn't make sense, not supported
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive---------------------------------------------- ----------------------------------
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) http://otherhost/otherpath$1 http://otherhost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via external redirection
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive (the [R] flag is redundant)
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive^localpath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive via internal proxy
013e1ddd21f2142a369c9a9a0eeb6c6a0bc3fcf3patrikj </directivesynopsis>
1c47b0c72c991a6f0ad172c74df0936fe13d6fbfslive</modulesynopsis>