2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mod_rewrite.xml.meta">
25 <name>mod_rewrite</name>
27 <description>Provides a rule-based rewriting engine to rewrite requested
28 URLs on the fly</description>
30 <status>Extension</status>
31 <sourcefile>mod_rewrite.c</sourcefile>
32 <identifier>rewrite_module</identifier>
35 <p>The <module>mod_rewrite</module> module uses a rule-based rewriting
36 engine, based on a PCRE regular-expression parser, to rewrite requested URLs on
37 the fly. By default, <module>mod_rewrite</module> maps a URL to a filesystem
38 path. However, it can also be used to redirect one URL to another URL, or
39 to invoke an internal proxy fetch.</p>
40 <p><module>mod_rewrite</module> provides a flexible and powerful way to
41 manipulate URLs using an unlimited number of rules. Each rule can have an
42 unlimited number of attached rule conditions, to allow you to rewrite URL
43 based on server variables, environment variables, HTTP headers, or time
45 <p><module>mod_rewrite</module> operates on the full URL path, including the
46 path-info section. A rewrite rule can be invoked in
47 <code>httpd.conf</code> or in <code>.htaccess</code>. The path generated
48 by a rewrite rule can include a query string, or can lead to internal
49 sub-processing, external request redirection, or internal proxy
52 <p>Further details, discussion, and examples, are provided in the
53 <a href="../rewrite/">detailed mod_rewrite documentation</a>.</p>
56 <section id="logging"><title>Logging</title>
58 <p><module>mod_rewrite</module> offers detailed logging of its actions
59 at the <code>trace1</code> to <code>trace8</code> log levels. The
60 log level can be set specifically for <module>mod_rewrite</module>
61 using the <directive module="core">LogLevel</directive> directive: Up to
62 level <code>debug</code>, no actions are logged, while <code>trace8</code>
63 means that practically all actions are logged.</p>
66 Using a high trace log level for <module>mod_rewrite</module>
67 will slow down your Apache HTTP Server dramatically! Use a log
68 level higher than <code>trace2</code> only for debugging!
71 <example><title>Example</title>
72 <highlight language="config">
73 LogLevel alert rewrite:trace3
77 <note><title>RewriteLog</title>
78 <p>Those familiar with earlier versions of
79 <module>mod_rewrite</module> will no doubt be looking for the
80 <code>RewriteLog</code> and <code>RewriteLogLevel</code>
81 directives. This functionality has been completely replaced by the
82 new per-module logging configuration mentioned above.
85 <p>To get just the <module>mod_rewrite</module>-specific log
86 messages, pipe the log file through grep:</p>
88 tail -f error_log|fgrep '[rewrite:'
95 <name>RewriteEngine</name>
96 <description>Enables or disables runtime rewriting engine</description>
97 <syntax>RewriteEngine on|off</syntax>
98 <default>RewriteEngine off</default>
99 <contextlist><context>server config</context><context>virtual host</context>
100 <context>directory</context><context>.htaccess</context></contextlist>
101 <override>FileInfo</override>
105 <p>The <directive>RewriteEngine</directive> directive enables or
106 disables the runtime rewriting engine. If it is set to
107 <code>off</code> this module does no runtime processing at
108 all. It does not even update the <code>SCRIPT_URx</code>
109 environment variables.</p>
111 <p>Use this directive to disable the module instead of
112 commenting out all the <directive
113 module="mod_rewrite">RewriteRule</directive> directives!</p>
115 <p>Note that rewrite configurations are not
116 inherited by virtual hosts. This means that you need to have a
117 <code>RewriteEngine on</code> directive for each virtual host
118 in which you wish to use rewrite rules.</p>
120 <p><directive>RewriteMap</directive> directives of the type <code>prg</code>
121 are not started during server initialization if they're defined in a
122 context that does not have <directive>RewriteEngine</directive> set to
129 <name>RewriteOptions</name>
130 <description>Sets some special options for the rewrite engine</description>
131 <syntax>RewriteOptions <var>Options</var></syntax>
132 <contextlist><context>server config</context><context>virtual host</context>
133 <context>directory</context><context>.htaccess</context></contextlist>
134 <override>FileInfo</override>
135 <compatibility><code>MaxRedirects</code> is no longer available in version 2.1 and
136 later</compatibility>
139 <p>The <directive>RewriteOptions</directive> directive sets some
140 special options for the current per-server or per-directory
141 configuration. The <em>Option</em> string can currently
142 only be one of the following:</p>
145 <dt><code>Inherit</code></dt>
148 <p>This forces the current configuration to inherit the
149 configuration of the parent. In per-virtual-server context,
150 this means that the maps, conditions and rules of the main
151 server are inherited. In per-directory context this means
152 that conditions and rules of the parent directory's
153 <code>.htaccess</code> configuration or
154 <directive type="section" module="core">Directory</directive>
155 sections are inherited. The inherited rules are virtually copied
156 to the section where this directive is being used. If used in
157 combination with local rules, the inherited rules are copied behind
158 the local rules. The position of this directive - below or above
159 of local rules - has no influence on this behavior. If local
160 rules forced the rewriting to stop, the inherited rules won't
163 <note type="warning">
164 Rules inherited from the parent scope are applied
165 <strong>after</strong> rules specified in the child scope.
169 <dt><code>InheritBefore</code></dt>
171 <p> Like <code>Inherit</code> above, but the rules from the parent scope
172 are applied <strong>before</strong> rules specified in the child scope.
173 Available in Apache HTTP Server 2.3.10 and later.</p>
176 <dt><code>AllowNoSlash</code></dt>
178 <p>By default, <module>mod_rewrite</module> will ignore URLs that map to a
179 directory on disk but lack a trailing slash, in the expectation that
180 the <module>mod_dir</module> module will issue the client with a redirect to
181 the canonical URL with a trailing slash.</p>
183 <p>When the <directive module="mod_dir">DirectorySlash</directive> directive
184 is set to off, the <code>AllowNoSlash</code> option can be enabled to ensure
185 that rewrite rules are no longer ignored. This option makes it possible to
186 apply rewrite rules within .htaccess files that match the directory without
187 a trailing slash, if so desired. Available in Apache HTTP Server 2.4.0 and
191 <dt><code>AllowAnyURI</code></dt>
194 <p>When <directive module="mod_rewrite">RewriteRule</directive>
195 is used in <code>VirtualHost</code> or server context with
196 version 2.2.22 or later of httpd, <module>mod_rewrite</module>
197 will only process the rewrite rules if the request URI is a <a
198 href="./directive-dict.html#Syntax">URL-path</a>. This avoids
199 some security issues where particular rules could allow
200 "surprising" pattern expansions (see <a
201 href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3368">CVE-2011-3368</a>
203 href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-4317">CVE-2011-4317</a>).
204 To lift the restriction on matching a URL-path, the
205 <code>AllowAnyURI</code> option can be enabled, and
206 <module>mod_rewrite</module> will apply the rule set to any
207 request URI string, regardless of whether that string matches
208 the URL-path grammar required by the HTTP specification.</p>
210 <note type="warning">
211 <title>Security Warning</title>
213 <p>Enabling this option will make the server vulnerable to
214 security issues if used with rewrite rules which are not
215 carefully authored. It is <strong>strongly recommended</strong>
216 that this option is not used. In particular, beware of input
217 strings containing the '<code>@</code>' character which could
218 change the interpretation of the transformed URI, as per the
230 <name>RewriteMap</name>
231 <description>Defines a mapping function for key-lookup</description>
232 <syntax>RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
234 <contextlist><context>server config</context><context>virtual host</context>
236 <compatibility>The choice of different dbm types is available in
237 Apache HTTP Server 2.0.41 and later</compatibility>
240 <p>The <directive>RewriteMap</directive> directive defines a
241 <em>Rewriting Map</em> which can be used inside rule
242 substitution strings by the mapping-functions to
243 insert/substitute fields through a key lookup. The source of
244 this lookup can be of various types.</p>
246 <p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is
247 the name of the map and will be used to specify a
248 mapping-function for the substitution strings of a rewriting
249 rule via one of the following constructs:</p>
252 <strong><code>${</code> <em>MapName</em> <code>:</code>
253 <em>LookupKey</em> <code>}</code><br />
254 <code>${</code> <em>MapName</em> <code>:</code>
255 <em>LookupKey</em> <code>|</code> <em>DefaultValue</em>
256 <code>}</code></strong>
259 <p>When such a construct occurs, the map <em>MapName</em> is
260 consulted and the key <em>LookupKey</em> is looked-up. If the
261 key is found, the map-function construct is substituted by
262 <em>SubstValue</em>. If the key is not found then it is
263 substituted by <em>DefaultValue</em> or by the empty string
264 if no <em>DefaultValue</em> was specified. Empty values
265 behave as if the key was absent, therefore it is not possible
266 to distinguish between empty-valued keys and absent keys.</p>
268 <p>For example, you might define a
269 <directive>RewriteMap</directive> as:</p>
271 <highlight language="config">
272 RewriteMap examplemap txt:/path/to/file/map.txt
275 <p>You would then be able to use this map in a
276 <directive>RewriteRule</directive> as follows:</p>
278 <highlight language="config">
279 RewriteRule ^/ex/(.*) ${examplemap:$1}
282 <p>The following combinations for <em>MapType</em> and
283 <em>MapSource</em> can be used:</p>
288 <dd>A plain text file containing space-separated key-value
289 pairs, one per line. (<a href="../rewrite/rewritemap.html#txt">Details ...</a>)</dd>
292 <dd>Randomly selects an entry from a plain text file (<a href="../rewrite/rewritemap.html#rnd">Details ...</a>)</dd>
295 <dd>Looks up an entry in a dbm file containing name, value
296 pairs. Hash is constructed from a plain text file format using
297 the <code><a href="../programs/httxt2dbm.html">httxt2dbm</a></code>
298 utility. (<a href="../rewrite/rewritemap.html#dbm">Details ...</a>)</dd>
301 <dd>One of the four available internal functions provided by
302 <code>RewriteMap</code>: toupper, tolower, escape or
303 unescape. (<a href="../rewrite/rewritemap.html#int">Details ...</a>)</dd>
306 <dd>Calls an external program or script to process the
307 rewriting. (<a href="../rewrite/rewritemap.html#prg">Details ...</a>)</dd>
309 <dt>dbd or fastdbd</dt>
310 <dd>A SQL SELECT statement to be performed to look up the
311 rewrite target. (<a href="../rewrite/rewritemap.html#dbd">Details ...</a>)</dd>
314 <p>Further details, and numerous examples, may be found in the <a
315 href="../rewrite/rewritemap.html">RewriteMap HowTo</a></p>
321 <name>RewriteBase</name>
322 <description>Sets the base URL for per-directory rewrites</description>
323 <syntax>RewriteBase <em>URL-path</em></syntax>
324 <default>None</default>
325 <contextlist><context>directory</context><context>.htaccess</context>
327 <override>FileInfo</override>
330 <p>The <directive>RewriteBase</directive> directive specifies the
331 URL prefix to be used for per-directory (htaccess)
332 <directive>RewriteRule</directive> directives that substitute a relative
334 <p> This directive is <em>required</em> when you use a relative path
335 in a substitution in per-directory (htaccess) context unless either
336 of the following conditions are true:</p>
338 <li> The original request, and the substitution, are underneath the
339 <directive module="core">DocumentRoot</directive>
340 (as opposed to reachable by other means, such as
341 <directive module="mod_alias">Alias</directive>).</li>
342 <li> The <em>filesystem</em> path to the directory containing the
343 <directive>RewriteRule</directive>, suffixed by the relative
344 substitution is also valid as a URL path on the server
348 <p> In the example below, <directive>RewriteBase</directive> is necessary
349 to avoid rewriting to http://example.com/opt/myapp-1.2.3/welcome.html
350 since the resource was not relative to the document root. This
351 misconfiguration would normally cause the server to look for an "opt"
352 directory under the document root.</p>
353 <highlight language="config">
354 DocumentRoot /var/www/example.com
355 Alias /myapp /opt/myapp-1.2.3
356 <Directory /opt/myapp-1.2.3>
359 RewriteRule ^index\.html$ welcome.html
367 <name>RewriteCond</name>
368 <description>Defines a condition under which rewriting will take place
371 <em>TestString</em> <em>CondPattern</em></syntax>
372 <contextlist><context>server config</context><context>virtual host</context>
373 <context>directory</context><context>.htaccess</context></contextlist>
374 <override>FileInfo</override>
377 <p>The <directive>RewriteCond</directive> directive defines a
378 rule condition. One or more <directive>RewriteCond</directive>
379 can precede a <directive module="mod_rewrite">RewriteRule</directive>
380 directive. The following rule is then only used if both
381 the current state of the URI matches its pattern, <strong
382 >and</strong> if these conditions are met.</p>
384 <p><em>TestString</em> is a string which can contain the
385 following expanded constructs in addition to plain text:</p>
389 <strong>RewriteRule backreferences</strong>: These are
390 backreferences of the form <strong><code>$N</code></strong>
391 (0 <= N <= 9). $1 to $9 provide access to the grouped
392 parts (in parentheses) of the pattern, from the
393 <code>RewriteRule</code> which is subject to the current
394 set of <code>RewriteCond</code> conditions. $0 provides
395 access to the whole string matched by that pattern.
398 <strong>RewriteCond backreferences</strong>: These are
399 backreferences of the form <strong><code>%N</code></strong>
400 (0 <= N <= 9). %1 to %9 provide access to the grouped
401 parts (again, in parentheses) of the pattern, from the last matched
402 <code>RewriteCond</code> in the current set
403 of conditions. %0 provides access to the whole string matched by
407 <strong>RewriteMap expansions</strong>: These are
408 expansions of the form <strong><code
409 >${mapname:key|default}</code></strong>.
410 See <a href="#mapfunc">the documentation for
411 RewriteMap</a> for more details.
414 <strong>Server-Variables</strong>: These are variables of
416 <strong><code>%{</code> <em>NAME_OF_VARIABLE</em>
417 <code>}</code></strong>
418 where <em>NAME_OF_VARIABLE</em> can be a string taken
419 from the following list:
422 <columnspec><column width=".3"/><column width=".3"/>
423 <column width=".3"/></columnspec>
425 <th>HTTP headers:</th> <th>connection & request:</th> <th></th>
430 HTTP_USER_AGENT<br />
435 HTTP_PROXY_CONNECTION<br />
446 SCRIPT_FILENAME<br />
456 <th>server internals:</th> <th>date and time:</th> <th>specials:</th>
466 SERVER_PROTOCOL<br />
467 SERVER_SOFTWARE<br />
485 REQUEST_FILENAME<br />
493 <p>These variables all
494 correspond to the similarly named HTTP
495 MIME-headers, C variables of the Apache HTTP Server or
496 <code>struct tm</code> fields of the Unix system.
497 Most are documented elsewhere in the Manual or in
498 the CGI specification.</p>
500 <p>SERVER_NAME and SERVER_PORT depend on the values of
501 <directive module="core">UseCanonicalName</directive> and
502 <directive module="core">UseCanonicalPhysicalPort</directive>
505 <p>Those that are special to mod_rewrite include those below.</p>
508 <dt><code>IS_SUBREQ</code></dt>
510 <dd>Will contain the text "true" if the request
511 currently being processed is a sub-request,
512 "false" otherwise. Sub-requests may be generated
513 by modules that need to resolve additional files
514 or URIs in order to complete their tasks.</dd>
516 <dt><code>API_VERSION</code></dt>
518 <dd>This is the version of the Apache httpd module API
519 (the internal interface between server and
520 module) in the current httpd build, as defined in
521 include/ap_mmn.h. The module API version
522 corresponds to the version of Apache httpd in use (in
523 the release version of Apache httpd 1.3.14, for
524 instance, it is 19990320:10), but is mainly of
525 interest to module authors.</dd>
527 <dt><code>THE_REQUEST</code></dt>
529 <dd>The full HTTP request line sent by the
530 browser to the server (e.g., "<code>GET
531 /index.html HTTP/1.1</code>"). This does not
532 include any additional headers sent by the
533 browser. This value has not been unescaped
534 (decoded), unlike most other variables below.</dd>
536 <dt><code>REQUEST_URI</code></dt>
538 <dd>The path component of the requested URI,
539 such as "/index.html". This notably excludes the
540 query string which is available as as its own variable
541 named <code>QUERY_STRING</code>.</dd>
543 <dt><code>REQUEST_FILENAME</code></dt>
545 <dd>The full local filesystem path to the file or
546 script matching the request, if this has already
547 been determined by the server at the time
548 <code>REQUEST_FILENAME</code> is referenced. Otherwise,
549 such as when used in virtual host context, the same
550 value as <code>REQUEST_URI</code>.</dd>
552 <dt><code>HTTPS</code></dt>
554 <dd>Will contain the text "on" if the connection is
555 using SSL/TLS, or "off" otherwise. (This variable
556 can be safely used regardless of whether or not
557 <module>mod_ssl</module> is loaded).</dd>
559 <dt><code>REQUEST_SCHEME</code></dt>
561 <dd>Will contain the scheme of the request (usually
562 "http" or "https"). This value can be influenced with
563 <directive module="core">ServerName</directive>.</dd>
570 <p>If the <em>TestString</em> has the special value <code>expr</code>,
571 the <em>CondPattern</em> will be treated as an
572 <a href="../expr.html">ap_expr</a>. HTTP headers referenced in the
573 expression will be added to the Vary header if the <code>novary</code>
574 flag is not given.</p>
576 <p>Other things you should be aware of:</p>
580 <p>The variables SCRIPT_FILENAME and REQUEST_FILENAME
581 contain the same value - the value of the
582 <code>filename</code> field of the internal
583 <code>request_rec</code> structure of the Apache HTTP Server.
584 The first name is the commonly known CGI variable name
585 while the second is the appropriate counterpart of
586 REQUEST_URI (which contains the value of the
587 <code>uri</code> field of <code>request_rec</code>).</p>
588 <p>If a substitution occurred and the rewriting continues,
589 the value of both variables will be updated accordingly.</p>
590 <p>If used in per-server context (<em>i.e.</em>, before the
591 request is mapped to the filesystem) SCRIPT_FILENAME and
592 REQUEST_FILENAME cannot contain the full local filesystem
593 path since the path is unknown at this stage of processing.
594 Both variables will initially contain the value of REQUEST_URI
595 in that case. In order to obtain the full local filesystem
596 path of the request in per-server context, use an URL-based
597 look-ahead <code>%{LA-U:REQUEST_FILENAME}</code> to determine
598 the final value of REQUEST_FILENAME.</p></li>
601 <code>%{ENV:variable}</code>, where <em>variable</em> can be
602 any environment variable, is also available.
603 This is looked-up via internal
604 Apache httpd structures and (if not found there) via
605 <code>getenv()</code> from the Apache httpd server process.</li>
608 <code>%{SSL:variable}</code>, where <em>variable</em> is the
609 name of an <a href="mod_ssl.html#envvars">SSL environment
610 variable</a>, can be used whether or not
611 <module>mod_ssl</module> is loaded, but will always expand to
612 the empty string if it is not. Example:
613 <code>%{SSL:SSL_CIPHER_USEKEYSIZE}</code> may expand to
614 <code>128</code>.</li>
617 <code>%{HTTP:header}</code>, where <em>header</em> can be
618 any HTTP MIME-header name, can always be used to obtain the
619 value of a header sent in the HTTP request.
620 Example: <code>%{HTTP:Proxy-Connection}</code> is
621 the value of the HTTP header
622 ``<code>Proxy-Connection:</code>''.
623 <p>If a HTTP header is used in a condition this header is added to
624 the Vary header of the response in case the condition evaluates to
625 to true for the request. It is <strong>not</strong> added if the
626 condition evaluates to false for the request. Adding the HTTP header
627 to the Vary header of the response is needed for proper caching.</p>
628 <p>It has to be kept in mind that conditions follow a short circuit
629 logic in the case of the '<strong><code>ornext|OR</code></strong>' flag
630 so that certain conditions might not be evaluated at all.</p></li>
633 <code>%{LA-U:variable}</code> can be used for look-aheads which perform
634 an internal (URL-based) sub-request to determine the final
635 value of <em>variable</em>. This can be used to access
636 variable for rewriting which is not available at the current
637 stage, but will be set in a later phase.
638 <p>For instance, to rewrite according to the
639 <code>REMOTE_USER</code> variable from within the
640 per-server context (<code>httpd.conf</code> file) you must
641 use <code>%{LA-U:REMOTE_USER}</code> - this
642 variable is set by the authorization phases, which come
643 <em>after</em> the URL translation phase (during which mod_rewrite
645 <p>On the other hand, because mod_rewrite implements
646 its per-directory context (<code>.htaccess</code> file) via
647 the Fixup phase of the API and because the authorization
648 phases come <em>before</em> this phase, you just can use
649 <code>%{REMOTE_USER}</code> in that context.</p></li>
652 <code>%{LA-F:variable}</code> can be used to perform an internal
653 (filename-based) sub-request, to determine the final value
654 of <em>variable</em>. Most of the time, this is the same as
658 <p><em>CondPattern</em> is the condition pattern,
659 a regular expression which is applied to the
660 current instance of the <em>TestString</em>.
661 <em>TestString</em> is first evaluated, before being matched against
662 <em>CondPattern</em>.</p>
664 <p><em>CondPattern</em> is usually a
665 <em>perl compatible regular expression</em>, but there is
666 additional syntax available to perform other useful tests against
667 the <em>Teststring</em>:</p>
670 <li>You can prefix the pattern string with a
671 '<code>!</code>' character (exclamation mark) to specify a
672 <strong>non</strong>-matching pattern.</li>
675 You can perform lexicographical string comparisons:
678 <li>'<strong><CondPattern</strong>' (lexicographically
680 Treats the <em>CondPattern</em> as a plain string and
681 compares it lexicographically to <em>TestString</em>. True if
682 <em>TestString</em> lexicographically precedes
683 <em>CondPattern</em>.</li>
685 <li>'<strong>>CondPattern</strong>' (lexicographically
687 Treats the <em>CondPattern</em> as a plain string and
688 compares it lexicographically to <em>TestString</em>. True if
689 <em>TestString</em> lexicographically follows
690 <em>CondPattern</em>.</li>
692 <li>'<strong>=CondPattern</strong>' (lexicographically
694 Treats the <em>CondPattern</em> as a plain string and
695 compares it lexicographically to <em>TestString</em>. True if
696 <em>TestString</em> is lexicographically equal to
697 <em>CondPattern</em> (the two strings are exactly
698 equal, character for character). If <em>CondPattern</em>
699 is <code>""</code> (two quotation marks) this
700 compares <em>TestString</em> to the empty string.</li>
702 <li>'<strong><=CondPattern</strong>' (lexicographically
703 less than or equal to)<br />
704 Treats the <em>CondPattern</em> as a plain string and
705 compares it lexicographically to <em>TestString</em>. True
706 if <em>TestString</em> lexicographically precedes
707 <em>CondPattern</em>, or is equal to <em>CondPattern</em>
708 (the two strings are equal, character for character).</li>
710 <li>'<strong>>=CondPattern</strong>' (lexicographically
711 greater than or equal to)<br />
712 Treats the <em>CondPattern</em> as a plain string and
713 compares it lexicographically to <em>TestString</em>. True
714 if <em>TestString</em> lexicographically follows
715 <em>CondPattern</em>, or is equal to <em>CondPattern</em>
716 (the two strings are equal, character for character).</li>
720 You can perform integer comparisons:
723 <li>'<strong>-eq</strong>' (is numerically
724 <strong>eq</strong>ual to)<br />
725 The <em>TestString</em> is treated as an integer, and is
726 numerically compared to the <em>CondPattern</em>. True if
727 the two are numerically equal.</li>
729 <li>'<strong>-ge</strong>' (is numerically
730 <strong>g</strong>reater than or <strong>e</strong>qual to)<br />
731 The <em>TestString</em> is treated as an integer, and is
732 numerically compared to the <em>CondPattern</em>. True if
733 the <em>TestString</em> is numerically greater than or equal
734 to the <em>CondPattern</em>.</li>
736 <li>'<strong>-gt</strong>' (is numerically
737 <strong>g</strong>reater <strong>t</strong>han)<br />
738 The <em>TestString</em> is treated as an integer, and is
739 numerically compared to the <em>CondPattern</em>. True if
740 the <em>TestString</em> is numerically greater than
741 the <em>CondPattern</em>.</li>
743 <li>'<strong>-le</strong>' (is numerically
744 <strong>l</strong>ess than or <strong>e</strong>qual to)<br />
745 The <em>TestString</em> is treated as an integer, and is
746 numerically compared to the <em>CondPattern</em>. True if
747 the <em>TestString</em> is numerically less than or equal
748 to the <em>CondPattern</em>. Avoid confusion with the
749 <strong>-l</strong> by using the <strong>-L</strong> or
750 <strong>-h</strong> variant.</li>
752 <li>'<strong>-lt</strong>' (is numerically
753 <strong>l</strong>ess <strong>t</strong>han)<br />
754 The <em>TestString</em> is treated as an integer, and is
755 numerically compared to the <em>CondPattern</em>. True if
756 the <em>TestString</em> is numerically less than
757 the <em>CondPattern</em>. Avoid confusion with the
758 <strong>-l</strong> by using the <strong>-L</strong> or
759 <strong>-h</strong> variant.</li>
764 <li>You can perform various file attribute tests:
766 <li>'<strong>-d</strong>' (is
767 <strong>d</strong>irectory)<br />
768 Treats the <em>TestString</em> as a pathname and tests
769 whether or not it exists, and is a directory.</li>
771 <li>'<strong>-f</strong>' (is regular
772 <strong>f</strong>ile)<br />
773 Treats the <em>TestString</em> as a pathname and tests
774 whether or not it exists, and is a regular file.</li>
776 <li>'<strong>-F</strong>' (is existing file, via
778 Checks whether or not <em>TestString</em> is a valid file,
779 accessible via all the server's currently-configured
780 access controls for that path. This uses an internal
781 subrequest to do the check, so use it with care -
782 it can impact your server's performance!</li>
784 <li>'<strong>-H</strong>' (is symbolic link, bash convention)<br />
785 See <strong>-l</strong>.</li>
787 <li>'<strong>-l</strong>' (is symbolic
788 <strong>l</strong>ink)<br />
789 Treats the <em>TestString</em> as a pathname and tests
790 whether or not it exists, and is a symbolic link. May also
791 use the bash convention of <strong>-L</strong> or
792 <strong>-h</strong> if there's a possibility of confusion
793 such as when using the <strong>-lt</strong> or
794 <strong>-le</strong> tests.</li>
796 <li>'<strong>-L</strong>' (is symbolic link, bash convention)<br />
797 See <strong>-l</strong>.</li>
799 <li>'<strong>-s</strong>' (is regular file, with
800 <strong>s</strong>ize)<br />
801 Treats the <em>TestString</em> as a pathname and tests
802 whether or not it exists, and is a regular file with size greater
805 <li>'<strong>-U</strong>' (is existing URL, via
807 Checks whether or not <em>TestString</em> is a valid URL,
808 accessible via all the server's currently-configured
809 access controls for that path. This uses an internal
810 subrequest to do the check, so use it with care -
811 it can impact your server's performance!</li>
813 <li>'<strong>-x</strong>' (has e<strong>x</strong>ecutable
815 Treats the <em>TestString</em> as a pathname and tests
816 whether or not it exists, and has executable permissions.
817 These permissions are determined according to
818 the underlying OS.</li>
822 <note><title>Note:</title>
823 All of these tests can
824 also be prefixed by an exclamation mark ('!') to
825 negate their meaning.
830 <p>If the <em>TestString</em> has the special value <code>expr</code>, the
831 <em>CondPattern</em> will be treated as an
832 <a href="../expr.html">ap_expr</a>.</p>
835 In the below example, <code>-strmatch</code> is used to
836 compare the <code>REFERER</code> against the site hostname,
837 to block unwanted hotlinking.
840 <highlight language="config">
841 RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"<br />
842 RewriteRule ^/images - [F]
846 <li>You can also set special flags for
847 <em>CondPattern</em> by appending
848 <strong><code>[</code><em>flags</em><code>]</code></strong>
849 as the third argument to the <code>RewriteCond</code>
850 directive, where <em>flags</em> is a comma-separated list of any of the
854 <li>'<strong><code>nocase|NC</code></strong>'
855 (<strong>n</strong>o <strong>c</strong>ase)<br />
856 This makes the test case-insensitive - differences
857 between 'A-Z' and 'a-z' are ignored, both in the
858 expanded <em>TestString</em> and the <em>CondPattern</em>.
859 This flag is effective only for comparisons between
860 <em>TestString</em> and <em>CondPattern</em>. It has no
861 effect on filesystem and subrequest checks.</li>
864 '<strong><code>ornext|OR</code></strong>'
865 (<strong>or</strong> next condition)<br />
866 Use this to combine rule conditions with a local OR
867 instead of the implicit AND. Typical example:
869 <highlight language="config">
870 RewriteCond %{REMOTE_HOST} ^host1 [OR]
871 RewriteCond %{REMOTE_HOST} ^host2 [OR]
872 RewriteCond %{REMOTE_HOST} ^host3
873 RewriteRule ...some special stuff for any of these hosts...
876 Without this flag you would have to write the condition/rule
880 <li>'<strong><code>novary|NV</code></strong>'
881 (<strong>n</strong>o <strong>v</strong>ary)<br />
882 If a HTTP header is used in the condition, this flag prevents
883 this header from being added to the Vary header of the response. <br />
884 Using this flag might break proper caching of the response if
885 the representation of this response varies on the value of this header.
886 So this flag should be only used if the meaning of the Vary header
893 <p><strong>Example:</strong></p>
895 <p>To rewrite the Homepage of a site according to the
896 ``<code>User-Agent:</code>'' header of the request, you can
897 use the following: </p>
899 <highlight language="config">
900 RewriteCond %{HTTP_USER_AGENT} ^Mozilla
901 RewriteRule ^/$ /homepage.max.html [L]
903 RewriteCond %{HTTP_USER_AGENT} ^Lynx
904 RewriteRule ^/$ /homepage.min.html [L]
906 RewriteRule ^/$ /homepage.std.html [L]
909 <p>Explanation: If you use a browser which identifies itself
910 as 'Mozilla' (including Netscape Navigator, Mozilla etc), then you
911 get the max homepage (which could include frames, or other special
913 If you use the Lynx browser (which is terminal-based), then
914 you get the min homepage (which could be a version designed for
915 easy, text-only browsing).
916 If neither of these conditions apply (you use any other browser,
917 or your browser identifies itself as something non-standard), you get
918 the std (standard) homepage.</p>
925 <name>RewriteRule</name>
926 <description>Defines rules for the rewriting engine</description>
928 <em>Pattern</em> <em>Substitution</em> [<em>flags</em>]</syntax>
929 <contextlist><context>server config</context><context>virtual host</context>
930 <context>directory</context><context>.htaccess</context></contextlist>
931 <override>FileInfo</override>
934 <p>The <directive>RewriteRule</directive> directive is the real
935 rewriting workhorse. The directive can occur more than once,
936 with each instance defining a single rewrite rule. The
937 order in which these rules are defined is important - this is the order
938 in which they will be applied at run-time.</p>
940 <p><a id="patterns" name="patterns"><em>Pattern</em></a> is
941 a perl compatible <a id="regexp" name="regexp">regular
942 expression</a>. On the first RewriteRule, it is matched against
943 the (%-decoded) <a href="./directive-dict.html#Syntax">URL-path</a> (or
944 <a href="./directive-dict.html#Syntax">file-path</a>, depending
945 on the context) of the request. Subsequent patterns are matched against the
946 output of the last matching RewriteRule.</p>
948 <note><title><a id="what_is_matched" name="what_is_matched">What is matched?</a></title>
949 <p>In <directive module="core">VirtualHost</directive> context,
950 The <em>Pattern</em> will initially be matched against the part of the
951 URL after the hostname and port, and before the query string (e.g. "/app1/index.html").</p>
953 <p>In <directive module="core">Directory</directive> and htaccess context,
954 the <em>Pattern</em> will initially be matched against the
955 <em>filesystem</em> path, after removing the prefix that led the server
956 to the current <directive>RewriteRule</directive> (e.g. "app1/index.html"
957 or "index.html" depending on where the directives are defined).</p>
959 <p>If you wish to match against the hostname, port, or query string, use a
960 <directive module="mod_rewrite">RewriteCond</directive> with the
961 <code>%{HTTP_HOST}</code>, <code>%{SERVER_PORT}</code>, or
962 <code>%{QUERY_STRING}</code> variables respectively.</p>
966 <note><title>Per-directory Rewrites</title>
968 <li>The rewrite engine may be used in <a
969 href="../howto/htaccess.html">.htaccess</a> files and in <directive type="section"
970 module="core">Directory</directive> sections, with some additional
973 <li>To enable the rewrite engine in this context, you need to set
974 "<code>RewriteEngine On</code>" <strong>and</strong>
975 "<code>Options FollowSymLinks</code>" must be enabled. If your
976 administrator has disabled override of <code>FollowSymLinks</code> for
977 a user's directory, then you cannot use the rewrite engine. This
978 restriction is required for security reasons.</li>
980 <li>When using the rewrite engine in <code>.htaccess</code> files the
981 per-directory prefix (which always is the same for a specific
982 directory) is automatically <em>removed</em> for the RewriteRule pattern matching
983 and automatically <em>added</em> after any relative (not starting with a
984 slash or protocol name) substitution encounters the end of a rule set.
985 See the <directive module="mod_rewrite">RewriteBase</directive>
986 directive for more information regarding what prefix will be added back to
987 relative substitutions.</li>
989 <li> If you wish to match against the full URL-path in a per-directory
990 (htaccess) RewriteRule, use the <code>%{REQUEST_URI}</code> variable in
991 a <directive>RewriteCond</directive>.</li>
993 <li>The removed prefix always ends with a slash, meaning the matching occurs against a string which
994 <em>never</em> has a leading slash. Therefore, a <em>Pattern</em> with <code>^/</code> never
995 matches in per-directory context.</li>
997 <li>Although rewrite rules are syntactically permitted in <directive
998 type="section" module="core">Location</directive> and <directive
999 type="section" module="core">Files</directive> sections, this
1000 should never be necessary and is unsupported.</li>
1004 <p>For some hints on <glossary ref="regex">regular
1005 expressions</glossary>, see
1006 the <a href="../rewrite/intro.html#regex">mod_rewrite
1007 Introduction</a>.</p>
1009 <p>In mod_rewrite, the NOT character
1010 ('<code>!</code>') is also available as a possible pattern
1011 prefix. This enables you to negate a pattern; to say, for instance:
1012 ``<em>if the current URL does <strong>NOT</strong> match this
1013 pattern</em>''. This can be used for exceptional cases, where
1014 it is easier to match the negative pattern, or as a last
1017 <note><title>Note</title>
1018 When using the NOT character to negate a pattern, you cannot include
1019 grouped wildcard parts in that pattern. This is because, when the
1020 pattern does NOT match (ie, the negation matches), there are no
1021 contents for the groups. Thus, if negated patterns are used, you
1022 cannot use <code>$N</code> in the substitution string!
1025 <p>The <a id="rhs" name="rhs"><em>Substitution</em></a> of a
1026 rewrite rule is the string that replaces the original URL-path that
1027 was matched by <em>Pattern</em>. The <em>Substitution</em> may
1032 <dt>file-system path</dt>
1034 <dd>Designates the location on the file-system of the resource
1035 to be delivered to the client. Substitutions are only
1036 treated as a file-system path when the rule is configured in
1037 server (virtualhost) context and the first component of the
1038 path in the substitution exists in the file-system</dd>
1043 module="core">DocumentRoot</directive>-relative path to the
1044 resource to be served. Note that <module>mod_rewrite</module>
1045 tries to guess whether you have specified a file-system path
1046 or a URL-path by checking to see if the first segment of the
1047 path exists at the root of the file-system. For example, if
1048 you specify a <em>Substitution</em> string of
1049 <code>/www/file.html</code>, then this will be treated as a
1050 URL-path <em>unless</em> a directory named <code>www</code>
1051 exists at the root or your file-system (or, in the case of
1052 using rewrites in a <code>.htaccess</code> file, relative to
1053 your document root), in which case it will
1054 be treated as a file-system path. If you wish other
1055 URL-mapping directives (such as <directive
1056 module="mod_alias">Alias</directive>) to be applied to the
1057 resulting URL-path, use the <code>[PT]</code> flag as
1058 described below.</dd>
1060 <dt>Absolute URL</dt>
1062 <dd>If an absolute URL is specified,
1063 <module>mod_rewrite</module> checks to see whether the
1064 hostname matches the current host. If it does, the scheme and
1065 hostname are stripped out and the resulting path is treated as
1066 a URL-path. Otherwise, an external redirect is performed for
1067 the given URL. To force an external redirect back to the
1068 current host, see the <code>[R]</code> flag below.</dd>
1070 <dt><code>-</code> (dash)</dt>
1072 <dd>A dash indicates that no substitution should be performed
1073 (the existing path is passed through untouched). This is used
1074 when a flag (see below) needs to be applied without changing
1079 <p>In addition to plain text, the <em>Substitution</em> string can include</p>
1082 <li>back-references (<code>$N</code>) to the RewriteRule
1085 <li>back-references (<code>%N</code>) to the last matched
1086 RewriteCond pattern</li>
1088 <li>server-variables as in rule condition test-strings
1089 (<code>%{VARNAME}</code>)</li>
1091 <li><a href="#mapfunc">mapping-function</a> calls
1092 (<code>${mapname:key|default}</code>)</li>
1095 <p>Back-references are identifiers of the form
1096 <code>$</code><strong>N</strong>
1097 (<strong>N</strong>=0..9), which will be replaced
1098 by the contents of the <strong>N</strong>th group of the
1099 matched <em>Pattern</em>. The server-variables are the same
1100 as for the <em>TestString</em> of a <code>RewriteCond</code>
1101 directive. The mapping-functions come from the
1102 <code>RewriteMap</code> directive and are explained there.
1103 These three types of variables are expanded in the order above.</p>
1105 <p>Rewrite rules are applied to the results of previous rewrite
1106 rules, in the order in which they are defined
1107 in the config file. The URL-path or file-system path (see <a
1108 href="#what_is_matched">"What is matched?"</a>, above) is <strong>completely
1109 replaced</strong> by the <em>Substitution</em> and the
1110 rewriting process continues until all rules have been applied,
1111 or it is explicitly terminated by an
1112 <a href="../rewrite/flags.html#flag_l"><code><strong>L</strong></code> flag</a>,
1113 or other flag which implies immediate termination, such as
1114 <code><strong>END</strong></code> or
1115 <code><strong>F</strong></code>.</p>
1117 <note><title>Modifying the Query String</title>
1118 <p>By default, the query string is passed through unchanged. You
1119 can, however, create URLs in the substitution string containing
1120 a query string part. Simply use a question mark inside the
1121 substitution string to indicate that the following text should
1122 be re-injected into the query string. When you want to erase an
1123 existing query string, end the substitution string with just a
1124 question mark. To combine new and old query strings, use the
1125 <code>[QSA]</code> flag.</p>
1128 <p>Additionally you can set special <a name="rewriteflags"
1129 id="rewriteflags">actions</a> to be performed by
1130 appending <strong><code>[</code><em>flags</em><code>]</code></strong>
1131 as the third argument to the <code>RewriteRule</code>
1132 directive. <em>Flags</em> is a comma-separated list, surround by square
1133 brackets, of any of the flags in the following table. More
1134 details, and examples, for each flag, are available in the <a
1135 href="../rewrite/flags.html">Rewrite Flags document</a>.</p>
1138 <tr><th>Flag and syntax</th>
1143 <td>Escape non-alphanumeric characters <em>before</em> applying
1144 the transformation. <em><a
1145 href="../rewrite/flags.html#flag_b">details ...</a></em></td>
1149 <td>Rule is chained to the following rule. If the rule fails,
1150 the rule(s) chained to it will be skipped. <em><a
1151 href="../rewrite/flags.html#flag_c">details ...</a></em></td>
1154 <td>cookie|CO=<em>NAME</em>:<em>VAL</em></td>
1155 <td>Sets a cookie in the client browser. Full syntax is:
1156 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>
1160 <td>discardpath|DPI</td>
1161 <td>Causes the PATH_INFO portion of the rewritten URI to be
1162 discarded. <em><a href="../rewrite/flags.html#flag_dpi">details
1166 <td>env|E=[!]<em>VAR</em>[:<em>VAL</em>]</td>
1167 <td>Causes an environment variable <em>VAR</em> to be set (to the
1168 value <em>VAL</em> if provided). The form !<em>VAR</em> causes
1169 the environment variable <em>VAR</em> to be unset.<em><a
1170 href="../rewrite/flags.html#flag_e">details ...</a></em></td>
1173 <td>forbidden|F</td>
1174 <td>Returns a 403 FORBIDDEN response to the client browser.
1175 <em><a href="../rewrite/flags.html#flag_f">details ...</a></em></td>
1179 <td>Returns a 410 GONE response to the client browser. <em><a
1180 href="../rewrite/flags.html#flag_g">details ...</a></em></td>
1183 <td>Handler|H=<em>Content-handler</em></td>
1184 <td>Causes the resulting URI to be sent to the specified
1185 <em>Content-handler</em> for processing. <em><a
1186 href="../rewrite/flags.html#flag_h">details ...</a></em></td>
1190 <td>Stop the rewriting process immediately and don't apply any
1191 more rules. Especially note caveats for per-directory and
1192 .htaccess context (see also the END flag). <em><a
1193 href="../rewrite/flags.html#flag_l">details ...</a></em></td>
1197 <td>Re-run the rewriting process, starting again with the first
1198 rule, using the result of the ruleset so far as a starting
1199 point. <em><a href="../rewrite/flags.html#flag_n">details
1204 <td>Makes the pattern comparison case-insensitive.
1205 <em><a href="../rewrite/flags.html#flag_nc">details ...</a></em></td>
1208 <td>noescape|NE</td>
1209 <td>Prevent mod_rewrite from applying hexcode escaping of
1210 special characters in the result of the rewrite. <em><a
1211 href="../rewrite/flags.html#flag_ne">details ...</a></em></td>
1214 <td>nosubreq|NS</td>
1215 <td>Causes a rule to be skipped if the current request is an
1216 internal sub-request. <em><a
1217 href="../rewrite/flags.html#flag_ns">details ...</a></em></td>
1221 <td>Force the substitution URL to be internally sent as a proxy
1222 request. <em><a href="../rewrite/flags.html#flag_p">details
1226 <td>passthrough|PT</td>
1227 <td>Forces the resulting URI to be passed back to the URL
1228 mapping engine for processing of other URI-to-filename
1229 translators, such as <code>Alias</code> or
1230 <code>Redirect</code>. <em><a
1231 href="../rewrite/flags.html#flag_pt">details ...</a></em></td>
1234 <td>qsappend|QSA</td>
1235 <td>Appends any query string from the original request URL to
1236 any query string created in the rewrite target.<em><a
1237 href="../rewrite/flags.html#flag_qsa">details ...</a></em></td>
1240 <td>qsdiscard|QSD</td>
1241 <td>Discard any query string attached to the incoming URI.
1242 <em><a href="../rewrite/flags.html#flag_qsd">details
1246 <td>redirect|R[=<em>code</em>]</td>
1247 <td>Forces an external redirect, optionally with the specified
1248 HTTP status code. <em><a
1249 href="../rewrite/flags.html#flag_r">details ...</a></em>
1254 <td>Stop the rewriting process immediately and don't apply any
1255 more rules. Also prevents further execution of rewrite rules
1256 in per-directory and .htaccess context. (Available in 2.3.9 and later)
1257 <em><a href="../rewrite/flags.html#flag_l">details ...</a></em></td>
1260 <td>skip|S=<em>num</em></td>
1261 <td>Tells the rewriting engine to skip the next <em>num</em>
1262 rules if the current rule matches. <em><a
1263 href="../rewrite/flags.html#flag_s">details ...</a></em></td>
1266 <td>type|T=<em>MIME-type</em></td>
1267 <td>Force the <glossary>MIME-type</glossary> of the target file
1268 to be the specified type. <em><a
1269 href="../rewrite/flags.html#flag_t">details ...</a></em></td>
1273 <note><title>Home directory expansion</title>
1274 <p> When the substitution string begins with a string
1275 resembling "/~user" (via explicit text or backreferences), mod_rewrite performs
1276 home directory expansion independent of the presence or configuration
1277 of <module>mod_userdir</module>.</p>
1279 <p> This expansion does not occur when the <em>PT</em>
1280 flag is used on the <directive module="mod_rewrite">RewriteRule</directive>
1285 <p>Here are all possible substitution combinations and their
1288 <p><strong>Inside per-server configuration
1289 (<code>httpd.conf</code>)<br />
1290 for request ``<code>GET
1291 /somepath/pathinfo</code>'':</strong><br />
1297 <th>Resulting Substitution</th>
1301 <td>^/somepath(.*) otherpath$1</td>
1302 <td>invalid, not supported</td>
1306 <td>^/somepath(.*) otherpath$1 [R]</td>
1307 <td>invalid, not supported</td>
1311 <td>^/somepath(.*) otherpath$1 [P]</td>
1312 <td>invalid, not supported</td>
1316 <td>^/somepath(.*) /otherpath$1</td>
1317 <td>/otherpath/pathinfo</td>
1321 <td>^/somepath(.*) /otherpath$1 [R]</td>
1322 <td>http://thishost/otherpath/pathinfo via external redirection</td>
1326 <td>^/somepath(.*) /otherpath$1 [P]</td>
1327 <td>doesn't make sense, not supported</td>
1331 <td>^/somepath(.*) http://thishost/otherpath$1</td>
1332 <td>/otherpath/pathinfo</td>
1336 <td>^/somepath(.*) http://thishost/otherpath$1 [R]</td>
1337 <td>http://thishost/otherpath/pathinfo via external redirection</td>
1341 <td>^/somepath(.*) http://thishost/otherpath$1 [P]</td>
1342 <td>doesn't make sense, not supported</td>
1346 <td>^/somepath(.*) http://otherhost/otherpath$1</td>
1347 <td>http://otherhost/otherpath/pathinfo via external redirection</td>
1351 <td>^/somepath(.*) http://otherhost/otherpath$1 [R]</td>
1352 <td>http://otherhost/otherpath/pathinfo via external redirection (the [R] flag is redundant)</td>
1356 <td>^/somepath(.*) http://otherhost/otherpath$1 [P]</td>
1357 <td>http://otherhost/otherpath/pathinfo via internal proxy</td>
1361 <p><strong>Inside per-directory configuration for
1362 <code>/somepath</code><br />
1363 (<code>/physical/path/to/somepath/.htaccess</code>, with
1364 <code>RewriteBase /somepath</code>)<br />
1365 for request ``<code>GET
1366 /somepath/localpath/pathinfo</code>'':</strong><br />
1373 <th>Resulting Substitution</th>
1377 <td>^localpath(.*) otherpath$1</td>
1378 <td>/somepath/otherpath/pathinfo</td>
1382 <td>^localpath(.*) otherpath$1 [R]</td>
1383 <td>http://thishost/somepath/otherpath/pathinfo via external
1388 <td>^localpath(.*) otherpath$1 [P]</td>
1389 <td>doesn't make sense, not supported</td>
1393 <td>^localpath(.*) /otherpath$1</td>
1394 <td>/otherpath/pathinfo</td>
1398 <td>^localpath(.*) /otherpath$1 [R]</td>
1399 <td>http://thishost/otherpath/pathinfo via external redirection</td>
1403 <td>^localpath(.*) /otherpath$1 [P]</td>
1404 <td>doesn't make sense, not supported</td>
1408 <td>^localpath(.*) http://thishost/otherpath$1</td>
1409 <td>/otherpath/pathinfo</td>
1413 <td>^localpath(.*) http://thishost/otherpath$1 [R]</td>
1414 <td>http://thishost/otherpath/pathinfo via external redirection</td>
1418 <td>^localpath(.*) http://thishost/otherpath$1 [P]</td>
1419 <td>doesn't make sense, not supported</td>
1423 <td>^localpath(.*) http://otherhost/otherpath$1</td>
1424 <td>http://otherhost/otherpath/pathinfo via external redirection</td>
1428 <td>^localpath(.*) http://otherhost/otherpath$1 [R]</td>
1429 <td>http://otherhost/otherpath/pathinfo via external redirection (the [R] flag is redundant)</td>
1433 <td>^localpath(.*) http://otherhost/otherpath$1 [P]</td>
1434 <td>http://otherhost/otherpath/pathinfo via internal proxy</td>
1440 </directivesynopsis>