]> granicus.if.org Git - apache/blobdiff - docs/manual/mod/mod_rewrite.html.en
rebuild
[apache] / docs / manual / mod / mod_rewrite.html.en
index fc11f82e5dfecc1343a114aa8d832c15d53e5538..e310b299f886c0ed93d159f2298675fadf3039bb 100644 (file)
@@ -5,19 +5,22 @@
               This file is generated from xml source: DO NOT EDIT
         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
       -->
-<title>mod_rewrite - Apache HTTP Server</title>
+<title>mod_rewrite - Apache HTTP Server Version 2.5</title>
 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
-<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
+<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
+<script src="../style/scripts/prettify.min.js" type="text/javascript">
+</script>
+
 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
 <body>
 <div id="page-header">
-<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
-<p class="apache">Apache HTTP Server Version 2.3</p>
+<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
+<p class="apache">Apache HTTP Server Version 2.5</p>
 <img alt="" src="../images/feather.gif" /></div>
 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
 <div id="path">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
 <div id="page-content">
 <div id="preamble"><h1>Apache Module mod_rewrite</h1>
 <div class="toplang">
@@ -31,21 +34,21 @@ URLs on the fly</td></tr>
 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_rewrite.c</td></tr></table>
 <h3>Summary</h3>
 
-       <p>The <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> module uses a rule-based rewriting 
-      engine, based on a regular-expression parser, to rewrite requested URLs on
-      the fly. By default, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> maps a URL to a filesystem 
+       <p>The <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> module uses a rule-based rewriting
+      engine, based on a PCRE regular-expression parser, to rewrite requested URLs on
+      the fly. By default, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> maps a URL to a filesystem
       path. However, it can also be used to redirect one URL to another URL, or
       to invoke an internal proxy fetch.</p>
-      <p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> provides a flexible and powerful way to 
-      manipulate URLs using an unlimited number of rules. Each rule can have an 
+      <p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> provides a flexible and powerful way to
+      manipulate URLs using an unlimited number of rules. Each rule can have an
       unlimited number of attached rule conditions, to allow you to rewrite URL
-      based on server variables, environment variables, HTTP headers, or time 
+      based on server variables, environment variables, HTTP headers, or time
       stamps.</p>
       <p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> operates on the full URL path, including the
-      path-info section. A rewrite rule can be invoked in 
-      <code>httpd.conf</code> or in <code>.htaccess</code>. The path generated 
-      by a rewrite rule can include a query string, or can lead to internal 
-      sub-processing, external request redirection, or internal proxy 
+      path-info section. A rewrite rule can be invoked in
+      <code>httpd.conf</code> or in <code>.htaccess</code>. The path generated
+      by a rewrite rule can include a query string, or can lead to internal
+      sub-processing, external request redirection, or internal proxy
       throughput.</p>
 
       <p>Further details, discussion, and examples, are provided in the
@@ -56,14 +59,50 @@ URLs on the fly</td></tr>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewritebase">RewriteBase</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewritecond">RewriteCond</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewriteengine">RewriteEngine</a></li>
-<li><img alt="" src="../images/down.gif" /> <a href="#rewritelog">RewriteLog</a></li>
-<li><img alt="" src="../images/down.gif" /> <a href="#rewriteloglevel">RewriteLogLevel</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewritemap">RewriteMap</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewriteoptions">RewriteOptions</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#rewriterule">RewriteRule</a></li>
 </ul>
+<h3>Topics</h3>
+<ul id="topics">
+<li><img alt="" src="../images/down.gif" /> <a href="#logging">Logging</a></li>
+</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="logging" id="logging">Logging</a></h2>
+
+    <p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> offers detailed logging of its actions
+    at the <code>trace1</code> to <code>trace8</code> log levels. The
+    log level can be set specifically for <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+    using the <code class="directive"><a href="../mod/core.html#loglevel">LogLevel</a></code> directive: Up to
+    level <code>debug</code>, no actions are logged, while <code>trace8</code>
+    means that practically all actions are logged.</p>
+
+    <div class="note">
+      Using a high trace log level for <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+      will slow down your Apache HTTP Server dramatically! Use a log
+      level higher than <code>trace2</code> only for debugging!
+    </div>
+
+    <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">LogLevel alert rewrite:trace3</pre>
 </div>
 
+    <div class="note"><h3>RewriteLog</h3>
+      <p>Those familiar with earlier versions of
+      <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> will no doubt be looking for the
+      <code>RewriteLog</code> and <code>RewriteLogLevel</code>
+      directives. This functionality has been completely replaced by the
+      new per-module logging configuration mentioned above.
+      </p>
+
+      <p>To get just the <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>-specific log
+      messages, pipe the log file through grep:</p>
+    <div class="example"><p><code>
+    tail -f error_log|fgrep '[rewrite:'
+    </code></p></div>
+    </div>
+
+</div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a></h2>
 <table class="directive">
@@ -75,34 +114,36 @@ URLs on the fly</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
 </table>
-      <p>The <code class="directive">RewriteBase</code> directive explicitly
-      sets the base URL-path (not filesystem directory path!)  for per-directory rewrites.
-      When you use a <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
-      in a <code>.htaccess</code> file, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> strips off
-      the local directory prefix before processing, then rewrites the rest of 
-      the URL. When the rewrite is completed, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
-      automatically adds the local directory prefix back on to the path.</p>
-      
-      <p>This directive is <em>required</em> for per-directory rewrites whose context
-      is a directory made available via the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>
-      directive.</p>
-
-      <p>If your URL path does not exist verbatim on the filesystem,
-      or isn't directly under your <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>,
-      you must use <code class="directive">RewriteBase</code> in every
-      <code>.htaccess</code> file where you want to use <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives.</p>
-
-      <p>The example below demonstrates how to map 
-      http://example.com/myapp/index.html to 
-      /home/www/example/newsite.html, in a <code>.htaccess</code> file. This 
-      assumes that the content available at
-      http://example.com/ is on disk at /home/www/example/</p>
-<div class="example"><pre>
-RewriteEngine On
-# The URL-path used to get to this context, not the filesystem path
-RewriteBase /myapp/
-RewriteRule ^index\.html$  newsite.html
-</pre></div>
+      <p>The <code class="directive">RewriteBase</code> directive specifies the
+      URL prefix to be used for per-directory (htaccess) 
+      <code class="directive">RewriteRule</code> directives that substitute a relative
+      path.</p>
+      <p> This directive is <em>required</em> when you use a relative path
+      in a substitution in per-directory (htaccess) context unless either
+      of the following conditions are true:</p>
+      <ul>
+          <li> The original request, and the substitution, are underneath the 
+               <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>
+               (as opposed to reachable by other means, such as 
+               <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>).</li>
+          <li> The <em>filesystem</em> path to the directory containing the
+               <code class="directive">RewriteRule</code>, suffixed by the relative 
+               substitution is also valid as a URL path on the server 
+               (this is rare).</li>
+      </ul>
+
+<p> In the example below, <code class="directive">RewriteBase</code> is necessary
+    to avoid rewriting to http://example.com/opt/myapp-1.2.3/welcome.html
+    since the resource was not relative to the document root.  This 
+    misconfiguration would normally cause the server to look for an "opt"
+    directory under the document root.</p>
+<pre class="prettyprint lang-config">DocumentRoot /var/www/example.com
+Alias /myapp /opt/myapp-1.2.3
+&lt;Directory /opt/myapp-1.2.3&gt;
+    RewriteEngine On
+    RewriteBase /myapp/
+    RewriteRule ^index\.html$  welcome.html 
+&lt;/Directory&gt;</pre>
 
 
 </div>
@@ -168,26 +209,30 @@ RewriteRule ^index\.html$  newsite.html
 
             <tr>
               <td>
-                 HTTP_USER_AGENT<br />
-                 HTTP_REFERER<br />
+                 HTTP_ACCEPT<br />
                  HTTP_COOKIE<br />
                  HTTP_FORWARDED<br />
                  HTTP_HOST<br />
                  HTTP_PROXY_CONNECTION<br />
-                 HTTP_ACCEPT<br />
+                 HTTP_REFERER<br />
+                 HTTP_USER_AGENT<br />
               </td>
 
               <td>
+                 AUTH_TYPE<br />
+                 CONN_REMOTE_ADDR<br />
+                 CONTEXT_PREFIX<br />
+                 CONTEXT_DOCUMENT_ROOT<br />
+                 IPV6<br />
+                 PATH_INFO<br />
+                 QUERY_STRING<br />
                  REMOTE_ADDR<br />
                  REMOTE_HOST<br />
+                 REMOTE_IDENT<br />
                  REMOTE_PORT<br />
                  REMOTE_USER<br />
-                 REMOTE_IDENT<br />
                  REQUEST_METHOD<br />
                  SCRIPT_FILENAME<br />
-                 PATH_INFO<br />
-                 QUERY_STRING<br />
-                 AUTH_TYPE<br />
               </td>
 
               <td />
@@ -200,9 +245,11 @@ RewriteRule ^index\.html$  newsite.html
             <tr>
               <td>
                  DOCUMENT_ROOT<br />
+                 SCRIPT_GROUP<br />
+                 SCRIPT_USER<br />
+                 SERVER_ADDR<br />
                  SERVER_ADMIN<br />
                  SERVER_NAME<br />
-                 SERVER_ADDR<br />
                  SERVER_PORT<br />
                  SERVER_PROTOCOL<br />
                  SERVER_SOFTWARE<br />
@@ -221,11 +268,14 @@ RewriteRule ^index\.html$  newsite.html
 
               <td>
                  API_VERSION<br />
-                 THE_REQUEST<br />
-                 REQUEST_URI<br />
-                 REQUEST_FILENAME<br />
-                 IS_SUBREQ<br />
+                 CONN_REMOTE_ADDR<br />
                  HTTPS<br />
+                 IS_SUBREQ<br />
+                 REMOTE_ADDR<br />
+                 REQUEST_FILENAME<br />
+                 REQUEST_SCHEME<br />
+                 REQUEST_URI<br />
+                 THE_REQUEST<br />
               </td>
             </tr>
           </table>
@@ -234,19 +284,17 @@ RewriteRule ^index\.html$  newsite.html
                 correspond to the similarly named HTTP
                 MIME-headers, C variables of the Apache HTTP Server or
                 <code>struct tm</code> fields of the Unix system.
-                Most are documented elsewhere in the Manual or in
-                the CGI specification. Those that are special to
-                mod_rewrite include those below.</p>
-        <div class="note">
-                <dl>
-                  <dt><code>IS_SUBREQ</code></dt>
+                Most are documented <a href="../expr.html#vars">here</a>
+                or elsewhere in the Manual or in the CGI specification.</p>
 
-                  <dd>Will contain the text "true" if the request
-                  currently being processed is a sub-request,
-                  "false" otherwise. Sub-requests may be generated
-                  by modules that need to resolve additional files
-                  or URIs in order to complete their tasks.</dd>
+                <p>SERVER_NAME and SERVER_PORT depend on the values of
+                <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code> and
+                <code class="directive"><a href="../mod/core.html#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code>
+                respectively.</p>
 
+                <p>Those that are special to mod_rewrite include those below.</p>
+        <div class="note">
+                <dl>
                   <dt><code>API_VERSION</code></dt>
 
                   <dd>This is the version of the Apache httpd module API
@@ -258,41 +306,77 @@ RewriteRule ^index\.html$  newsite.html
                   instance, it is 19990320:10), but is mainly of
                   interest to module authors.</dd>
 
-                  <dt><code>THE_REQUEST</code></dt>
+                  <dt><code>CONN_REMOTE_ADDR</code></dt>
 
-                  <dd>The full HTTP request line sent by the
-                  browser to the server (e.g., "<code>GET
-                  /index.html HTTP/1.1</code>"). This does not
-                  include any additional headers sent by the
-                  browser.</dd>
+                  <dd>Since 2.4.8: The peer IP address of the connection (see the
+                  <code class="module"><a href="../mod/mod_remoteip.html">mod_remoteip</a></code> module).</dd>
 
-                  <dt><code>REQUEST_URI</code></dt>
+                  <dt><code>HTTPS</code></dt>
 
-                  <dd>The resource requested in the HTTP request
-                  line. (In the example above, this would be
-                  "/index.html".)</dd>
+                  <dd>Will contain the text "on" if the connection is
+                  using SSL/TLS, or "off" otherwise.  (This variable
+                  can be safely used regardless of whether or not
+                  <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> is loaded).</dd>
+
+                  <dt><code>IS_SUBREQ</code></dt>
+
+                  <dd>Will contain the text "true" if the request
+                  currently being processed is a sub-request,
+                  "false" otherwise. Sub-requests may be generated
+                  by modules that need to resolve additional files
+                  or URIs in order to complete their tasks.</dd>
+
+                  <dt><code>REMOTE_ADDR</code></dt>
+
+                  <dd>The IP address of the remote host (see the
+                  <code class="module"><a href="../mod/mod_remoteip.html">mod_remoteip</a></code> module).</dd>
 
                   <dt><code>REQUEST_FILENAME</code></dt>
 
                   <dd>The full local filesystem path to the file or
                   script matching the request, if this has already
-                  been determined by the server at the time 
-                  <code>REQUEST_FILENAME</code> is referenced. Otherwise, 
-                  such as when used in virtual host context, the same 
-                  value as <code>REQUEST_URI</code>.</dd>
+                  been determined by the server at the time
+                  <code>REQUEST_FILENAME</code> is referenced. Otherwise,
+                  such as when used in virtual host context, the same
+                  value as <code>REQUEST_URI</code>.  Depending on the value of 
+                  <code class="directive"><a href="../mod/core.html#acceptpathinfo">AcceptPathInfo</a></code>, the
+                  server may have only used some leading components of the 
+                  <code>REQUEST_URI</code> to map the request to a file.
+                  </dd>
 
-                  <dt><code>HTTPS</code></dt>
+                  <dt><code>REQUEST_SCHEME</code></dt>
 
-                  <dd>Will contain the text "on" if the connection is
-                  using SSL/TLS, or "off" otherwise.  (This variable
-                  can be safely used regardless of whether or not
-                  <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> is loaded).</dd>
+                  <dd>Will contain the scheme of the request (usually
+                  "http" or "https"). This value can be influenced with
+                  <code class="directive"><a href="../mod/core.html#servername">ServerName</a></code>.</dd>
+
+                  <dt><code>REQUEST_URI</code></dt>
+
+                  <dd>The path component of the requested URI,
+                  such as "/index.html".  This notably excludes the
+                  query string which is available as as its own variable
+                  named <code>QUERY_STRING</code>.</dd>
+
+                  <dt><code>THE_REQUEST</code></dt>
+
+                  <dd>The full HTTP request line sent by the
+                  browser to the server (e.g., "<code>GET
+                  /index.html HTTP/1.1</code>"). This does not
+                  include any additional headers sent by the
+                  browser.  This value has not been unescaped
+                  (decoded), unlike most other variables below.</dd>
 
                 </dl>
 </div>
         </li>
       </ul>
 
+      <p>If the <em>TestString</em> has the special value <code>expr</code>,
+      the <em>CondPattern</em> will be treated as an
+      <a href="../expr.html">ap_expr</a>. HTTP headers referenced in the
+      expression will be added to the Vary header if the <code>novary</code>
+      flag is not given.</p>
+
       <p>Other things you should be aware of:</p>
 
       <ol>
@@ -341,7 +425,7 @@ RewriteRule ^index\.html$  newsite.html
         the value of the HTTP header
         ``<code>Proxy-Connection:</code>''.
         <p>If a HTTP header is used in a condition this header is added to
-        the Vary header of the response in case the condition evaluates to
+        the Vary header of the response in case the condition evaluates
         to true for the request. It is <strong>not</strong> added if the
         condition evaluates to false for the request. Adding the HTTP header
         to the Vary header of the response is needed for proper caching.</p>
@@ -350,7 +434,8 @@ RewriteRule ^index\.html$  newsite.html
         so that certain conditions might not be evaluated at all.</p></li>
 
         <li>
-        <code>%{LA-U:variable}</code> can be used for look-aheads which perform
+        <a id="LA-U" name="LA-U"><code>%{LA-U:variable}</code></a> 
+        can be used for look-aheads which perform
         an internal (URL-based) sub-request to determine the final
         value of <em>variable</em>. This can be used to access
         variable for rewriting which is not available at the current
@@ -381,9 +466,10 @@ RewriteRule ^index\.html$  newsite.html
       <em>TestString</em> is first evaluated, before being matched against
       <em>CondPattern</em>.</p>
 
-      <p><strong>Remember:</strong> <em>CondPattern</em> is a
-      <em>perl compatible regular expression</em> with some
-      additions:</p>
+      <p><em>CondPattern</em> is usually a
+      <em>perl compatible regular expression</em>, but there is
+      additional syntax available to perform other useful tests against
+      the <em>Teststring</em>:</p>
 
       <ol>
         <li>You can prefix the pattern string with a
@@ -391,9 +477,7 @@ RewriteRule ^index\.html$  newsite.html
         <strong>non</strong>-matching pattern.</li>
 
         <li>
-          There are some special variants of <em>CondPatterns</em>.
-          Instead of real regular expression strings you can also
-          use one of the following:
+          You can perform lexicographical string comparisons:
 
           <ul>
             <li>'<strong>&lt;CondPattern</strong>' (lexicographically
@@ -420,6 +504,70 @@ RewriteRule ^index\.html$  newsite.html
             is <code>""</code> (two quotation marks) this
             compares <em>TestString</em> to the empty string.</li>
 
+            <li>'<strong>&lt;=CondPattern</strong>' (lexicographically
+            less than or equal to)<br />
+            Treats the <em>CondPattern</em> as a plain string and
+            compares it lexicographically to <em>TestString</em>. True
+            if <em>TestString</em> lexicographically precedes
+            <em>CondPattern</em>, or is equal to <em>CondPattern</em>
+            (the two strings are equal, character for character).</li>
+
+            <li>'<strong>&gt;=CondPattern</strong>' (lexicographically
+            greater than or equal to)<br />
+            Treats the <em>CondPattern</em> as a plain string and
+            compares it lexicographically to <em>TestString</em>. True
+            if <em>TestString</em> lexicographically follows
+            <em>CondPattern</em>, or is equal to <em>CondPattern</em>
+            (the two strings are equal, character for character).</li>
+        </ul></li>
+
+        <li>
+          You can perform integer comparisons:
+          <ul>
+
+            <li>'<strong>-eq</strong>' (is numerically
+            <strong>eq</strong>ual to)<br />
+            The <em>TestString</em> is treated as an integer, and is
+            numerically compared to the <em>CondPattern</em>. True if
+            the two are numerically equal.</li>
+
+            <li>'<strong>-ge</strong>' (is numerically
+            <strong>g</strong>reater than or <strong>e</strong>qual to)<br />
+            The <em>TestString</em> is treated as an integer, and is
+            numerically compared to the <em>CondPattern</em>. True if
+            the <em>TestString</em> is numerically greater than or equal
+            to the <em>CondPattern</em>.</li>
+
+             <li>'<strong>-gt</strong>' (is numerically
+            <strong>g</strong>reater <strong>t</strong>han)<br />
+            The <em>TestString</em> is treated as an integer, and is
+            numerically compared to the <em>CondPattern</em>. True if
+            the <em>TestString</em> is numerically greater than
+            the <em>CondPattern</em>.</li>
+
+            <li>'<strong>-le</strong>' (is numerically
+            <strong>l</strong>ess than or <strong>e</strong>qual to)<br />
+            The <em>TestString</em> is treated as an integer, and is
+            numerically compared to the <em>CondPattern</em>. True if
+            the <em>TestString</em> is numerically less than or equal
+            to the <em>CondPattern</em>. Avoid confusion with the
+            <strong>-l</strong> by using the <strong>-L</strong> or
+            <strong>-h</strong> variant.</li>
+
+             <li>'<strong>-lt</strong>' (is numerically
+            <strong>l</strong>ess <strong>t</strong>han)<br />
+            The <em>TestString</em> is treated as an integer, and is
+            numerically compared to the <em>CondPattern</em>. True if
+            the <em>TestString</em> is numerically less than
+            the <em>CondPattern</em>. Avoid confusion with the
+            <strong>-l</strong> by using the <strong>-L</strong> or
+            <strong>-h</strong> variant.</li>
+
+           </ul>
+        </li>
+
+        <li>You can perform various file attribute tests:
+          <ul>
             <li>'<strong>-d</strong>' (is
             <strong>d</strong>irectory)<br />
              Treats the <em>TestString</em> as a pathname and tests
@@ -430,16 +578,47 @@ RewriteRule ^index\.html$  newsite.html
              Treats the <em>TestString</em> as a pathname and tests
             whether or not it exists, and is a regular file.</li>
 
+            <li>'<strong>-F</strong>' (is existing file, via
+            subrequest)<br />
+            Checks whether or not <em>TestString</em> is a valid file,
+            accessible via all the server's currently-configured
+            access controls for that path. This uses an internal
+            subrequest to do the check, so use it with care -
+            it can impact your server's performance!</li>
+
+            <li>'<strong>-H</strong>' (is symbolic link, bash convention)<br />
+            See <strong>-l</strong>.</li>
+
+            <li>'<strong>-l</strong>' (is symbolic
+            <strong>l</strong>ink)<br />
+            Treats the <em>TestString</em> as a pathname and tests
+            whether or not it exists, and is a symbolic link. May also
+            use the bash convention of <strong>-L</strong> or
+            <strong>-h</strong> if there's a possibility of confusion
+            such as when using the <strong>-lt</strong> or
+            <strong>-le</strong> tests.</li>
+
+            <li>'<strong>-L</strong>' (is symbolic link, bash convention)<br />
+            See <strong>-l</strong>.</li>
+
             <li>'<strong>-s</strong>' (is regular file, with
             <strong>s</strong>ize)<br />
             Treats the <em>TestString</em> as a pathname and tests
             whether or not it exists, and is a regular file with size greater
             than zero.</li>
 
-            <li>'<strong>-l</strong>' (is symbolic
-            <strong>l</strong>ink)<br />
-            Treats the <em>TestString</em> as a pathname and tests
-            whether or not it exists, and is a symbolic link.</li>
+            <li><p>'<strong>-U</strong>' (is existing URL, via
+            subrequest)<br />
+            Checks whether or not <em>TestString</em> is a valid URL,
+            accessible via all the server's currently-configured
+            access controls for that path. This uses an internal
+            subrequest to do the check, so use it with care -
+            it can impact your server's performance!</p>
+            <p> This flag <em>only</em> returns information about things
+            like access control, authentication, and authorization.  This flag
+            <em>does not</em> return information about the status code the 
+            configured handler (static file, CGI, proxy, etc.) would have 
+            returned.</p> </li>
 
             <li>'<strong>-x</strong>' (has e<strong>x</strong>ecutable
             permissions)<br />
@@ -448,21 +627,6 @@ RewriteRule ^index\.html$  newsite.html
             These permissions are determined according to
             the underlying OS.</li>
 
-            <li>'<strong>-F</strong>' (is existing file, via
-            subrequest)<br />
-            Checks whether or not <em>TestString</em> is a valid file,
-            accessible via all the server's currently-configured
-            access controls for that path. This uses an internal
-            subrequest to do the check, so use it with care -
-            it can impact your server's performance!</li>
-
-            <li>'<strong>-U</strong>' (is existing URL, via
-            subrequest)<br />
-            Checks whether or not <em>TestString</em> is a valid URL,
-            accessible via all the server's currently-configured
-            access controls for that path. This uses an internal
-            subrequest to do the check, so use it with care -
-            it can impact your server's performance!</li>
           </ul>
 
 <div class="note"><h3>Note:</h3>
@@ -472,6 +636,22 @@ RewriteRule ^index\.html$  newsite.html
 </div>
         </li>
 
+       <li>
+           <p>If the <em>TestString</em> has the special value <code>expr</code>, the
+           <em>CondPattern</em> will be treated as an
+           <a href="../expr.html">ap_expr</a>.</p>
+
+           <p>
+            In the below example, <code>-strmatch</code> is used to
+            compare the <code>REFERER</code> against the site hostname,
+            to block unwanted hotlinking.
+           </p>
+
+           <pre class="prettyprint lang-config">           RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"<br />
+           RewriteRule ^/images - [F]</pre>
+
+        </li>
+
         <li>You can also set special flags for
       <em>CondPattern</em> by appending
         <strong><code>[</code><em>flags</em><code>]</code></strong>
@@ -495,12 +675,11 @@ RewriteRule ^index\.html$  newsite.html
           Use this to combine rule conditions with a local OR
           instead of the implicit AND. Typical example:
 
-<div class="example"><pre>
-RewriteCond %{REMOTE_HOST}  ^host1.*  [OR]
-RewriteCond %{REMOTE_HOST}  ^host2.*  [OR]
-RewriteCond %{REMOTE_HOST}  ^host3.*
-RewriteRule ...some special stuff for any of these hosts...
-</pre></div>
+<pre class="prettyprint lang-config">RewriteCond %{REMOTE_HOST}  ^host1  [OR]
+RewriteCond %{REMOTE_HOST}  ^host2  [OR]
+RewriteCond %{REMOTE_HOST}  ^host3
+RewriteRule ...some special stuff for any of these hosts...</pre>
+
 
           Without this flag you would have to write the condition/rule
           pair three times.
@@ -525,26 +704,17 @@ RewriteRule ...some special stuff for any of these hosts...
         ``<code>User-Agent:</code>'' header of the request, you can
         use the following: </p>
 
-<div class="example"><pre>
-RewriteCond  %{HTTP_USER_AGENT}  ^Mozilla.*
-RewriteRule  ^/$                 /homepage.max.html  [L]
+<pre class="prettyprint lang-config">RewriteCond  %{HTTP_USER_AGENT}  (iPhone|Blackberry|Android)
+RewriteRule  ^/$                 /homepage.mobile.html  [L]
 
-RewriteCond  %{HTTP_USER_AGENT}  ^Lynx.*
-RewriteRule  ^/$                 /homepage.min.html  [L]
+RewriteRule  ^/$                 /homepage.std.html  [L]</pre>
 
-RewriteRule  ^/$                 /homepage.std.html  [L]
-</pre></div>
 
         <p>Explanation: If you use a browser which identifies itself
-        as 'Mozilla' (including Netscape Navigator, Mozilla etc), then you
-        get the max homepage (which could include frames, or other special
-        features).
-        If you use the Lynx browser (which is terminal-based), then
-        you get the min homepage (which could be a version designed for
-        easy, text-only browsing).
-        If neither of these conditions apply (you use any other browser,
-        or your browser identifies itself as something non-standard), you get
-        the std (standard) homepage.</p>
+        as a mobile browser (note that the example is incomplete, as
+        there are many other mobile platforms), the mobile version of
+        the homepage is served. Otherwise, the standard page is served.
+        </p>
 
 
 </div>
@@ -566,8 +736,8 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       all. It does not even update the <code>SCRIPT_URx</code>
       environment variables.</p>
 
-      <p>Use this directive to disable the module instead of
-      commenting out all the <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives!</p>
+      <p>Use this directive to disable rules in a particular context,
+      rather than commenting out all the <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives.</p>
 
       <p>Note that rewrite configurations are not
       inherited by virtual hosts. This means that you need to have a
@@ -579,80 +749,6 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       context that does not have <code class="directive">RewriteEngine</code>  set to
       <code>on</code></p>
 
-</div>
-<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="directive-section"><h2><a name="RewriteLog" id="RewriteLog">RewriteLog</a> <a name="rewritelog" id="rewritelog">Directive</a></h2>
-<table class="directive">
-<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the name of the file used for logging rewrite engine
-processing</td></tr>
-<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteLog <em>file-path</em></code></td></tr>
-<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
-<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
-<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
-</table>
-      <p>The <code class="directive">RewriteLog</code> directive sets the name
-      of the file to which the server logs any rewriting actions it
-      performs. If the name does not begin with a slash
-      ('<code>/</code>') then it is assumed to be relative to the
-      <em>Server Root</em>. The directive should occur only once per
-      server config.</p>
-
-<div class="note">    To disable the logging of
-          rewriting actions it is not recommended to set
-          <em>Filename</em> to <code>/dev/null</code>, because
-          although the rewriting engine does not then output to a
-          logfile it still creates the logfile output internally.
-          <strong>This will slow down the server with no advantage
-          to the administrator!</strong> To disable logging either
-          remove or comment out the <code class="directive">RewriteLog</code>
-          directive or use <code>RewriteLogLevel 0</code>!
-</div>
-
-<div class="note"><h3>Security</h3>
-
-See the <a href="../misc/security_tips.html">Apache HTTP Server Security Tips</a>
-document for details on how your security could be compromised if the
-directory where logfiles are stored is writable by anyone other than
-the user that starts the server.
-</div>
-
-<div class="example"><h3>Example</h3><p><code>
-RewriteLog "/usr/local/var/apache/logs/rewrite.log"
-</code></p></div>
-
-
-</div>
-<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="directive-section"><h2><a name="RewriteLogLevel" id="RewriteLogLevel">RewriteLogLevel</a> <a name="rewriteloglevel" id="rewriteloglevel">Directive</a></h2>
-<table class="directive">
-<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the verbosity of the log file used by the rewrite
-engine</td></tr>
-<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteLogLevel <em>Level</em></code></td></tr>
-<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>RewriteLogLevel 0</code></td></tr>
-<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
-<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
-<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
-</table>
-      <p>The <code class="directive">RewriteLogLevel</code> directive sets the
-      verbosity level of the rewriting logfile. The default level 0
-      means no logging, while 9 or more means that practically all
-      actions are logged.</p>
-
-      <p>To disable the logging of rewriting actions simply set
-      <em>Level</em> to 0. This disables all rewrite action
-      logs.</p>
-
-<div class="note"> Using a high value for
-          <em>Level</em> will slow down your Apache HTTP Server
-          dramatically! Use the rewriting logfile at a
-          <em>Level</em> greater than 2 only for debugging!
-</div>
-
-<div class="example"><h3>Example</h3><p><code>
-RewriteLogLevel 3
-</code></p></div>
-
-
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="directive-section"><h2><a name="RewriteMap" id="RewriteMap">RewriteMap</a> <a name="rewritemap" id="rewritemap">Directive</a></h2>
@@ -663,8 +759,6 @@ RewriteLogLevel 3
 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
-<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The choice of different dbm types is available in
-Apache HTTP Server 2.0.41 and later</td></tr>
 </table>
       <p>The <code class="directive">RewriteMap</code> directive defines a
       <em>Rewriting Map</em> which can be used inside rule
@@ -690,74 +784,53 @@ Apache HTTP Server 2.0.41 and later</td></tr>
       key is found, the map-function construct is substituted by
       <em>SubstValue</em>. If the key is not found then it is
       substituted by <em>DefaultValue</em> or by the empty string
-      if no <em>DefaultValue</em> was specified.</p>
+      if no <em>DefaultValue</em> was specified. Empty values
+      behave as if the key was absent, therefore it is not possible
+      to distinguish between empty-valued keys and absent keys.</p>
 
       <p>For example, you might define a
       <code class="directive">RewriteMap</code> as:</p>
 
-      <div class="example"><p><code>
-      RewriteMap examplemap txt:/path/to/file/map.txt
-      </code></p></div>
+      <pre class="prettyprint lang-config">RewriteMap examplemap txt:/path/to/file/map.txt</pre>
+
 
       <p>You would then be able to use this map in a
       <code class="directive">RewriteRule</code> as follows:</p>
 
-      <div class="example"><p><code>
-      RewriteRule ^/ex/(.*) ${examplemap:$1}
-      </code></p></div>
+      <pre class="prettyprint lang-config">RewriteRule ^/ex/(.*) ${examplemap:$1}</pre>
+
 
       <p>The following combinations for <em>MapType</em> and
       <em>MapSource</em> can be used:</p>
 
-    <table>
-    <tr><th>Map Type</th>
-        <th>Description</th></tr>
+    <dl>
 
-    <tr>
-        <td><code>txt</code></td>
-        <td>A plain text file containing space-separated key-value
-        pairs, one per line.</td>
-        <td><a href="../rewrite/rewritemap.html#txt">Details ...</a></td>
-    </tr>
+    <dt>txt</dt>
+        <dd>A plain text file containing space-separated key-value
+        pairs, one per line. (<a href="../rewrite/rewritemap.html#txt">Details ...</a>)</dd>
 
-    <tr>
-        <td><code>rnd</code></td>
-        <td>Randomly selects an entry from a plain text file</td>
-        <td><a href="../rewrite/rewritemap.html#rnd">Details ...</a></td>
-    </tr>
+    <dt>rnd</dt>
+        <dd>Randomly selects an entry from a plain text file (<a href="../rewrite/rewritemap.html#rnd">Details ...</a>)</dd>
 
-    <tr>
-        <td><code>dbm</code></td>
-        <td>Looks up an entry in a dbm file containing name, value
+    <dt>dbm</dt>
+        <dd>Looks up an entry in a dbm file containing name, value
         pairs. Hash is constructed from a plain text file format using
-        the <code><a href="../programs/httxt2dbm.html">httxt2dbm</a></code> 
-        utility.</td>
-        <td><a href="../rewrite/rewritemap.html#dbm">Details ...</a></td>
-    </tr>
+        the <code><a href="../programs/httxt2dbm.html">httxt2dbm</a></code>
+        utility.  (<a href="../rewrite/rewritemap.html#dbm">Details ...</a>)</dd>
 
-    <tr>
-        <td><code>int</code></td>
-        <td>One of the four available internal functions provided by
+    <dt>int</dt>
+        <dd>One of the four available internal functions provided by
         <code>RewriteMap</code>: toupper, tolower, escape or
-        unescape.</td>
-        <td><a href="../rewrite/rewritemap.html#int">Details ...</a></td>
-    </tr>
-
-    <tr>
-        <td><code>prg</code></td>
-        <td>Calls an external program or script to process the
-        rewriting.</td>
-        <td><a href="../rewrite/rewritemap.html#prg">Details ...</a></td>
-    </tr>
+        unescape. (<a href="../rewrite/rewritemap.html#int">Details ...</a>)</dd>
 
-    <tr>
-        <td><code>dbd</code> or <code>fastdbd</code></td>
-        <td>A SQL SELECT statement to be performed to look up the
-        rewrite target.</td>
-        <td><a href="../rewrite/rewritemap.html#dbd">Details ...</a></td>
-    </tr>
+    <dt>prg</dt>
+        <dd>Calls an external program or script to process the
+        rewriting. (<a href="../rewrite/rewritemap.html#prg">Details ...</a>)</dd>
 
-    </table>
+    <dt>dbd or fastdbd</dt>
+        <dd>A SQL SELECT statement to be performed to look up the
+        rewrite target. (<a href="../rewrite/rewritemap.html#dbd">Details ...</a>)</dd>
+    </dl>
 
     <p>Further details, and numerous examples, may be found in the <a href="../rewrite/rewritemap.html">RewriteMap HowTo</a></p>
 
@@ -772,8 +845,6 @@ Apache HTTP Server 2.0.41 and later</td></tr>
 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
-<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td><code>MaxRedirects</code> is no longer available in version 2.1 and
-later</td></tr>
 </table>
 
       <p>The <code class="directive">RewriteOptions</code> directive sets some
@@ -782,8 +853,10 @@ later</td></tr>
       only be one of the following:</p>
 
       <dl>
-      <dt><code>inherit</code></dt>
-      <dd>This forces the current configuration to inherit the
+      <dt><code>Inherit</code></dt>
+      <dd>
+
+      <p>This forces the current configuration to inherit the
       configuration of the parent. In per-virtual-server context,
       this means that the maps, conditions and rules of the main
       server are inherited. In per-directory context this means
@@ -796,9 +869,107 @@ later</td></tr>
       the local rules. The position of this directive - below or above
       of local rules - has no influence on this behavior. If local
       rules forced the rewriting to stop, the inherited rules won't
-      be processed.</dd>
+      be processed.</p>
+
+      <div class="warning">
+      Rules inherited from the parent scope are applied
+      <strong>after</strong> rules specified in the child scope.
+      </div>
+      </dd>
+
+      <dt><code>InheritBefore</code></dt>
+      <dd>
+      <p> Like <code>Inherit</code> above, but the rules from the parent scope
+      are applied <strong>before</strong> rules specified in the child scope.<br />
+      Available in Apache HTTP Server 2.3.10 and later.</p>
+      </dd>
+
+      <dt><code>InheritDown</code></dt>
+      <dd>
+
+      <p>If this option is enabled, all child configurations will inherit
+      the configuration of the current configuration. It is equivalent to
+      specifying <code>RewriteOptions Inherit</code> in all child
+      configurations. See the <code>Inherit</code> option for more details
+      on how the parent-child relationships are handled.<br />
+      Available in Apache HTTP Server 2.4.8 and later.</p>
+      </dd>
+
+      <dt><code>InheritDownBefore</code></dt>
+      <dd>
+
+      <p>Like <code>InheritDown</code> above, but the rules from the current
+      scope are applied <strong>before</strong> rules specified in any child's
+      scope.<br />
+      Available in Apache HTTP Server 2.4.8 and later.</p>
+      </dd>
+
+      <dt><code>IgnoreInherit</code></dt>
+      <dd>
+
+      <p>This option forces the current and child configurations to ignore
+      all rules that would be inherited from a parent specifying
+      <code>InheritDown</code> or <code>InheritDownBefore</code>.<br />
+      Available in Apache HTTP Server 2.4.8 and later.</p>
+      </dd>
+
+      <dt><code>AllowNoSlash</code></dt>
+      <dd>
+      <p>By default, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> will ignore URLs that map to a
+      directory on disk but lack a trailing slash, in the expectation that
+      the <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> module will issue the client with a redirect to
+      the canonical URL with a trailing slash.</p>
+      
+      <p>When the <code class="directive"><a href="../mod/mod_dir.html#directoryslash">DirectorySlash</a></code> directive
+      is set to off, the <code>AllowNoSlash</code> option can be enabled to ensure
+      that rewrite rules are no longer ignored. This option makes it possible to
+      apply rewrite rules within .htaccess files that match the directory without
+      a trailing slash, if so desired.<br />
+      Available in Apache HTTP Server 2.4.0 and later.</p>
+      </dd>
+
+      <dt><code>AllowAnyURI</code></dt>
+      <dd>
+
+      <p>When <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
+      is used in <code>VirtualHost</code> or server context with
+      version 2.2.22 or later of httpd, <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
+      will only process the rewrite rules if the request URI is a <a href="directive-dict.html#Syntax">URL-path</a>.  This avoids
+      some security issues where particular rules could allow
+      "surprising" pattern expansions (see <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3368">CVE-2011-3368</a>
+      and <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-4317">CVE-2011-4317</a>).
+      To lift the restriction on matching a URL-path, the
+      <code>AllowAnyURI</code> option can be enabled, and
+      <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> will apply the rule set to any
+      request URI string, regardless of whether that string matches
+      the URL-path grammar required by the HTTP specification.<br />
+      Available in Apache HTTP Server 2.4.3 and later.</p>
+
+      <div class="warning">
+      <h3>Security Warning</h3> 
+
+      <p>Enabling this option will make the server vulnerable to
+      security issues if used with rewrite rules which are not
+      carefully authored.  It is <strong>strongly recommended</strong>
+      that this option is not used.  In particular, beware of input
+      strings containing the '<code>@</code>' character which could
+      change the interpretation of the transformed URI, as per the
+      above CVE names.</p>
+      </div>
+      </dd>
+
+      <dt><code>MergeBase</code></dt>
+      <dd>
+
+      <p>With this option, the value of <code class="directive"><a href="#rewritebase">RewriteBase</a></code> is copied from where it's explicitly defined
+      into any sub-directory or sub-location that doesn't define its own
+      <code class="directive"><a href="#rewritebase">RewriteBase</a></code>. This was the
+      default behavior in 2.4.0 through 2.4.3, and the flag to restore it is
+      available Apache HTTP Server 2.4.4 and later.</p>
+      </dd>
       </dl>
 
+
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="directive-section"><h2><a name="RewriteRule" id="RewriteRule">RewriteRule</a> <a name="rewriterule" id="rewriterule">Directive</a></h2>
@@ -819,30 +990,62 @@ later</td></tr>
 
       <p><a id="patterns" name="patterns"><em>Pattern</em></a> is
       a perl compatible <a id="regexp" name="regexp">regular
-      expression</a>. On the first RewriteRule it is applied to the (%-encoded)
-      <a href="./directive-dict.html#Syntax">URL-path</a> of the request;
-      subsequent patterns are applied to the output of the last matched
-      RewriteRule.</p>
-
-<div class="note"><h3>What is matched?</h3>
-      <p>The <em>Pattern</em> will initially be matched against the part of the
-      URL after the hostname and port, and before the query string.</p>
-
-      <p>When the RewriteRule appears in per-directory (htaccess) context, the 
-      <em>Pattern</em> is matched against what remains of the URL after removing
-      the prefix that lead Apache httpd to the current rules (see the 
-      <code class="directive"><a href="#rewritebase">RewriteBase</a></code>).  The removed prefix
-      always ends with a slash, meaning the matching occurs against a string which
-      never has a leading slash.  A <em>Pattern</em> with <code>^/</code> never
-      matches in per-directory context.</p>
+      expression</a>. On the first RewriteRule, it is matched against
+      the (%-decoded) <a href="directive-dict.html#Syntax">URL-path</a> (or 
+      <a href="directive-dict.html#Syntax">file-path</a>, depending 
+      on the context) of the request. Subsequent patterns are matched against the 
+      output of the last matching RewriteRule.</p>
+
+<div class="note"><h3><a id="what_is_matched" name="what_is_matched">What is matched?</a></h3>
+      <p>In <code class="directive"><a href="../mod/core.html#virtualhost">VirtualHost</a></code> context,
+      The <em>Pattern</em> will initially be matched against the part of the
+      URL after the hostname and port, and before the query string (e.g. "/app1/index.html").</p>
+
+      <p>In <code class="directive"><a href="../mod/core.html#directory">Directory</a></code> and htaccess context,
+      the <em>Pattern</em> will initially be matched against the
+      <em>filesystem</em> path, after removing the prefix that led the server
+      to the current <code class="directive">RewriteRule</code> (e.g. "app1/index.html"
+      or "index.html" depending on where the directives are defined).</p>
 
       <p>If you wish to match against the hostname, port, or query string, use a
       <code class="directive"><a href="#rewritecond">RewriteCond</a></code> with the
       <code>%{HTTP_HOST}</code>, <code>%{SERVER_PORT}</code>, or
-      <code>%{QUERY_STRING}</code> variables respectively. If you wish to 
-      match against the full URL-path in a per-directory (htaccess) RewriteRule, 
-      use the <code>%{REQUEST_URI}</code> variable.</p>
+      <code>%{QUERY_STRING}</code> variables respectively.</p>
 
+</div>
+
+<div class="note"><h3>Per-directory Rewrites</h3>
+<ul>
+<li>The rewrite engine may be used in <a href="../howto/htaccess.html">.htaccess</a> files and in <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code> sections, with some additional
+complexity.</li>
+
+<li>To enable the rewrite engine in this context, you need to set
+"<code>RewriteEngine On</code>" <strong>and</strong>
+"<code>Options FollowSymLinks</code>" must be enabled. If your
+administrator has disabled override of <code>FollowSymLinks</code> for
+a user's directory, then you cannot use the rewrite engine. This
+restriction is required for security reasons.</li>
+
+<li>When using the rewrite engine in <code>.htaccess</code> files the
+per-directory prefix (which always is the same for a specific
+directory) is automatically <em>removed</em> for the RewriteRule pattern matching
+and automatically <em>added</em> after any relative (not starting with a
+slash or protocol name) substitution encounters the end of a rule set.
+See the <code class="directive"><a href="#rewritebase">RewriteBase</a></code>
+directive for more information regarding what prefix will be added back to
+relative substitutions.</li>
+
+<li> If you wish to match against the full URL-path in a per-directory
+(htaccess) RewriteRule, use the <code>%{REQUEST_URI}</code> variable in
+a <code class="directive">RewriteCond</code>.</li>
+
+<li>The removed prefix always ends with a slash, meaning the matching occurs against a string which
+<em>never</em> has a leading slash.  Therefore, a <em>Pattern</em> with <code>^/</code> never
+matches in per-directory context.</li>
+
+<li>Although rewrite rules are syntactically permitted in <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code> and <code class="directive"><a href="../mod/core.html#files">&lt;Files&gt;</a></code> sections, this
+should never be necessary and is unsupported.</li>
+</ul>
 </div>
 
       <p>For some hints on <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular
@@ -876,7 +1079,10 @@ cannot use <code>$N</code> in the substitution string!
         <dt>file-system path</dt>
 
         <dd>Designates the location on the file-system of the resource
-        to be delivered to the client.</dd>
+        to be delivered to the client.  Substitutions are only
+        treated as a file-system path when the rule is configured in 
+        server (virtualhost) context and the first component of the
+        path in the substitution exists in the file-system</dd>
 
         <dt>URL-path</dt>
 
@@ -888,7 +1094,9 @@ cannot use <code>$N</code> in the substitution string!
         you specify a <em>Substitution</em> string of
         <code>/www/file.html</code>, then this will be treated as a
         URL-path <em>unless</em> a directory named <code>www</code>
-        exists at the root or your file-system, in which case it will
+        exists at the root or your file-system (or, in the case of 
+        using rewrites in a <code>.htaccess</code> file, relative to
+        your document root), in which case it will
         be treated as a file-system path. If you wish other
         URL-mapping directives (such as <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>) to be applied to the
         resulting URL-path, use the <code>[PT]</code> flag as
@@ -913,7 +1121,7 @@ cannot use <code>$N</code> in the substitution string!
 
       </dl>
 
-      <p>In addition to plain text, the <em>Substition</em> string can include</p>
+      <p>In addition to plain text, the <em>Substitution</em> string can include</p>
 
       <ol>
         <li>back-references (<code>$N</code>) to the RewriteRule
@@ -939,14 +1147,16 @@ cannot use <code>$N</code> in the substitution string!
       <code>RewriteMap</code> directive and are explained there.
       These three types of variables are expanded in the order above.</p>
 
-      <p>As already mentioned, all rewrite rules are
-      applied to the <em>Substitution</em> (in the order in which
-      they are defined
-      in the config file). The URL is <strong>completely
+      <p>Rewrite rules are applied to the results of previous rewrite
+      rules, in the order in which they are defined
+      in the config file. The URL-path or file-system path (see <a href="#what_is_matched">"What is matched?"</a>, above) is <strong>completely
       replaced</strong> by the <em>Substitution</em> and the
       rewriting process continues until all rules have been applied,
-      or it is explicitly terminated by a
-      <code><strong>L</strong></code> flag.</p>
+      or it is explicitly terminated by an
+      <a href="../rewrite/flags.html#flag_l"><code><strong>L</strong></code> flag</a>,
+      or other flag which implies immediate termination, such as
+      <code><strong>END</strong></code> or
+      <code><strong>F</strong></code>.</p>
 
      <div class="note"><h3>Modifying the Query String</h3>
       <p>By default, the query string is passed through unchanged. You
@@ -966,120 +1176,134 @@ cannot use <code>$N</code> in the substitution string!
       brackets, of any of the flags in the following table. More
       details, and examples, for each flag, are available in the <a href="../rewrite/flags.html">Rewrite Flags document</a>.</p>
 
-    <table>
-    <tr><th>Flag and syntax</th>
+    <table class="bordered"><tr class="header"><th>Flag and syntax</th>
         <th>Function</th>
     </tr>
-    <tr>
+<tr>
         <td>B</td>
-        <td>Escape non-alphanumeric characters <em>before</em> applying
-        the transformation. <em><a href="../rewrite/flags.html#flag_b">details ...</a></em></td>
+        <td>Escape non-alphanumeric characters in backreferences <em>before</em> 
+        applying the transformation. <em><a href="../rewrite/flags.html#flag_b">details ...</a></em></td>
+    </tr>
+<tr class="odd">
+        <td>backrefnoplus|BNP</td>
+        <td>If backreferences are being escaped, spaces should be escaped to 
+        %20 instead of +. Useful when the backreference will be used in the
+        path component rather than the query string.<em><a href="../rewrite/flags.html#flag_bnp">details ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>chain|C</td>
         <td>Rule is chained to the following rule. If the rule fails,
         the rule(s) chained to it will be skipped. <em><a href="../rewrite/flags.html#flag_c">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>cookie|CO=<em>NAME</em>:<em>VAL</em></td>
-        <td>Sets a cookie in the client browser. Full syntax is: 
-        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>
+        <td>Sets a cookie in the client browser. Full syntax is:
+        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>
         </td>
     </tr>
-    <tr>
-        <td>discardpathinfo|DPI</td>
+<tr>
+        <td>discardpath|DPI</td>
         <td>Causes the PATH_INFO portion of the rewritten URI to be
-        discarded. <em><a href="../rewrite/flags.html#flag_dpi">details 
+        discarded. <em><a href="../rewrite/flags.html#flag_dpi">details
         ...</a></em></td>
     </tr>
-    <tr>
-        <td>env|E=<em>VAR</em>:<em>VAL</em></td>
-        <td>Causes an environment variable <em>VAR</em> to be set to the
-        value <em>VAL</em>. <em><a href="../rewrite/flags.html#flag_e">details ...</a></em></td>
+<tr class="odd">
+        <td>END</td>
+        <td>Stop the rewriting process immediately and don't apply any
+        more rules. Also prevents further execution of rewrite rules
+        in per-directory and .htaccess context. (Available in 2.3.9 and later)
+        <em><a href="../rewrite/flags.html#flag_end">details ...</a></em></td>
+    </tr>
+<tr>
+        <td>env|E=[!]<em>VAR</em>[:<em>VAL</em>]</td>
+        <td>Causes an environment variable <em>VAR</em> to be set (to the
+        value <em>VAL</em> if provided). The form !<em>VAR</em> causes
+        the environment variable <em>VAR</em> to be unset.
+        <em><a href="../rewrite/flags.html#flag_e">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>forbidden|F</td>
         <td>Returns a 403 FORBIDDEN response to the client browser.
         <em><a href="../rewrite/flags.html#flag_f">details ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>gone|G</td>
         <td>Returns a 410 GONE response to the client browser. <em><a href="../rewrite/flags.html#flag_g">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>Handler|H=<em>Content-handler</em></td>
         <td>Causes the resulting URI to be sent to the specified
         <em>Content-handler</em> for processing. <em><a href="../rewrite/flags.html#flag_h">details ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>last|L</td>
         <td>Stop the rewriting process immediately and don't apply any
         more rules. Especially note caveats for per-directory and
-        .htaccess context. <em><a href="../rewrite/flags.html#flag_l">details ...</a></em></td>
+        .htaccess context (see also the END flag). <em><a href="../rewrite/flags.html#flag_l">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>next|N</td>
         <td>Re-run the rewriting process, starting again with the first
         rule, using the result of the ruleset so far as a starting
         point. <em><a href="../rewrite/flags.html#flag_n">details
         ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>nocase|NC</td>
-        <td>Makes the pattern pattern comparison case-insensitive.
+        <td>Makes the pattern comparison case-insensitive.
         <em><a href="../rewrite/flags.html#flag_nc">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>noescape|NE</td>
         <td>Prevent mod_rewrite from applying hexcode escaping of
         special characters in the result of the rewrite. <em><a href="../rewrite/flags.html#flag_ne">details ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>nosubreq|NS</td>
         <td>Causes a rule to be skipped if the current request is an
         internal sub-request. <em><a href="../rewrite/flags.html#flag_ns">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>proxy|P</td>
         <td>Force the substitution URL to be internally sent as a proxy
         request. <em><a href="../rewrite/flags.html#flag_p">details
         ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>passthrough|PT</td>
         <td>Forces the resulting URI to be passed back to the URL
         mapping engine for processing of other URI-to-filename
         translators, such as <code>Alias</code> or
         <code>Redirect</code>. <em><a href="../rewrite/flags.html#flag_pt">details ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>qsappend|QSA</td>
-        <td>Appends any query string created in the rewrite target to
-        any query string that was in the original request URL. <em><a href="../rewrite/flags.html#flag_qsa">details ...</a></em></td>
+        <td>Appends any query string from the original request URL to 
+        any query string created in the rewrite target.<em><a href="../rewrite/flags.html#flag_qsa">details ...</a></em></td>
     </tr>
-    <tr>
+<tr>
         <td>qsdiscard|QSD</td>
         <td>Discard any query string attached to the incoming URI.
         <em><a href="../rewrite/flags.html#flag_qsd">details
         ...</a></em></td>
     </tr>
-    <tr>
+<tr class="odd">
         <td>redirect|R[=<em>code</em>]</td>
         <td>Forces an external redirect, optionally with the specified
         HTTP status code. <em><a href="../rewrite/flags.html#flag_r">details ...</a></em>
         </td>
     </tr>
-    <tr>
+<tr>
         <td>skip|S=<em>num</em></td>
         <td>Tells the rewriting engine to skip the next <em>num</em>
         rules if the current rule matches. <em><a href="../rewrite/flags.html#flag_s">details ...</a></em></td>
     </tr>
-    <tr>
-        <td>tyle|T=<em>MIME-type</em></td>
+<tr class="odd">
+        <td>type|T=<em>MIME-type</em></td>
         <td>Force the <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME-type</a> of the target file
         to be the specified type. <em><a href="../rewrite/flags.html#flag_t">details ...</a></em></td>
     </tr>
-    </table>
+</table>
 
 <div class="note"><h3>Home directory expansion</h3>
 <p> When the substitution string begins with a string
@@ -1092,39 +1316,6 @@ flag is used on the <code class="directive"><a href="#rewriterule">RewriteRule</
 directive.</p>
 </div>
 
-<div class="note"><h3>Per-directory Rewrites</h3>
-
-<p>The rewrite engine may be used in <a href="../howto/htaccess.html">.htaccess</a> files.  To enable the
-rewrite engine for these files you need to set
-"<code>RewriteEngine On</code>" <strong>and</strong>
-"<code>Options FollowSymLinks</code>" must be enabled. If your
-administrator has disabled override of <code>FollowSymLinks</code> for
-a user's directory, then you cannot use the rewrite engine. This
-restriction is required for security reasons.</p>
-
-<p>When using the rewrite engine in <code>.htaccess</code> files the
-per-directory prefix (which always is the same for a specific
-directory) is automatically <em>removed</em> for the pattern matching
-and automatically <em>added</em> after the substitution has been
-done. This feature is essential for many sorts of rewriting; without
-this, you would always have to match the parent directory, which is
-not always possible.  There is one exception: If a substitution string
-starts with <code>http://</code>, then the directory prefix will
-<strong>not</strong> be added, and an external redirect (or proxy
-throughput, if using flag <strong>P</strong>) is forced.  See the
-<code class="directive"><a href="#rewritebase">RewriteBase</a></code> directive for
-more information.</p>
-
-<p>The rewrite engine may also be used in <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code> sections with the same
-prefix-matching rules as would be applied to <code>.htaccess</code>
-files.  It is usually simpler, however, to avoid the prefix substitution
-complication by putting the rewrite rules in the main server or
-virtual host context, rather than in a <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code> section.</p>
-
-<p>Although rewrite rules are syntactically permitted in <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code> and <code class="directive"><a href="../mod/core.html#files">&lt;Files&gt;</a></code> sections, this
-should never be necessary and is unsupported.</p>
-
-</div>
 
      <p>Here are all possible substitution combinations and their
       meanings:</p>
@@ -1135,89 +1326,151 @@ should never be necessary and is unsupported.</p>
       /somepath/pathinfo</code>'':</strong><br />
       </p>
 
-<div class="note"><pre>
-<strong>Given Rule</strong>                                      <strong>Resulting Substitution</strong>
-----------------------------------------------  ----------------------------------
-^/somepath(.*) otherpath$1                      invalid, not supported
-
-^/somepath(.*) otherpath$1  [R]                 invalid, not supported
-
-^/somepath(.*) otherpath$1  [P]                 invalid, not supported
-----------------------------------------------  ----------------------------------
-^/somepath(.*) /otherpath$1                     /otherpath/pathinfo
-
-^/somepath(.*) /otherpath$1 [R]                 http://thishost/otherpath/pathinfo
-                                                via external redirection
-
-^/somepath(.*) /otherpath$1 [P]                 doesn't make sense, not supported
-----------------------------------------------  ----------------------------------
-^/somepath(.*) http://thishost/otherpath$1      /otherpath/pathinfo
-
-^/somepath(.*) http://thishost/otherpath$1 [R]  http://thishost/otherpath/pathinfo
-                                                via external redirection
-
-^/somepath(.*) http://thishost/otherpath$1 [P]  doesn't make sense, not supported
-----------------------------------------------  ----------------------------------
-^/somepath(.*) http://otherhost/otherpath$1     http://otherhost/otherpath/pathinfo
-                                                via external redirection
-
-^/somepath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
-                                                via external redirection
-                                                (the [R] flag is redundant)
-
-^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
-                                                via internal proxy
-</pre></div>
+<table class="bordered"><tr class="header">
+<th>Given Rule</th>
+<th>Resulting Substitution</th>
+</tr>
+<tr>
+<td>^/somepath(.*) otherpath$1</td>
+<td>invalid, not supported</td>
+</tr>
+<tr class="odd">
+<td>^/somepath(.*) otherpath$1  [R]</td>
+<td>invalid, not supported</td>
+</tr>
+<tr>
+<td>^/somepath(.*) otherpath$1  [P]</td>
+<td>invalid, not supported</td>
+</tr>
+<tr class="odd">
+<td>^/somepath(.*) /otherpath$1</td>
+<td>/otherpath/pathinfo</td>
+</tr>
+<tr>
+<td>^/somepath(.*) /otherpath$1 [R]</td>
+<td>http://thishost/otherpath/pathinfo via external redirection</td>
+</tr>
+<tr class="odd">
+<td>^/somepath(.*) /otherpath$1 [P]</td>
+<td>doesn't make sense, not supported</td>
+</tr>
+<tr>
+<td>^/somepath(.*) http://thishost/otherpath$1</td>
+<td>/otherpath/pathinfo</td>
+</tr>
+<tr class="odd">
+<td>^/somepath(.*) http://thishost/otherpath$1 [R]</td>
+<td>http://thishost/otherpath/pathinfo via external redirection</td>
+</tr>
+<tr>
+<td>^/somepath(.*) http://thishost/otherpath$1 [P]</td>
+<td>doesn't make sense, not supported</td>
+</tr>
+<tr class="odd">
+<td>^/somepath(.*) http://otherhost/otherpath$1</td>
+<td>http://otherhost/otherpath/pathinfo via external redirection</td>
+</tr>
+<tr>
+<td>^/somepath(.*) http://otherhost/otherpath$1 [R]</td>
+<td>http://otherhost/otherpath/pathinfo via external redirection (the [R] flag is redundant)</td>
+</tr>
+<tr class="odd">
+<td>^/somepath(.*) http://otherhost/otherpath$1 [P]</td>
+<td>http://otherhost/otherpath/pathinfo via internal proxy</td>
+</tr>
+</table>
 
       <p><strong>Inside per-directory configuration for
       <code>/somepath</code><br />
-       (<code>/physical/path/to/somepath/.htacccess</code>, with
+       (<code>/physical/path/to/somepath/.htaccess</code>, with
       <code>RewriteBase /somepath</code>)<br />
        for request ``<code>GET
       /somepath/localpath/pathinfo</code>'':</strong><br />
      </p>
 
-<div class="note"><pre>
-<strong>Given Rule</strong>                                      <strong>Resulting Substitution</strong>
-----------------------------------------------  ----------------------------------
-^localpath(.*) otherpath$1                      /somepath/otherpath/pathinfo
-
-^localpath(.*) otherpath$1  [R]                 http://thishost/somepath/otherpath/pathinfo
-                                                via external redirection
-
-^localpath(.*) otherpath$1  [P]                 doesn't make sense, not supported
-----------------------------------------------  ----------------------------------
-^localpath(.*) /otherpath$1                     /otherpath/pathinfo
-
-^localpath(.*) /otherpath$1 [R]                 http://thishost/otherpath/pathinfo
-                                                via external redirection
-
-^localpath(.*) /otherpath$1 [P]                 doesn't make sense, not supported
-----------------------------------------------  ----------------------------------
-^localpath(.*) http://thishost/otherpath$1      /otherpath/pathinfo
-
-^localpath(.*) http://thishost/otherpath$1 [R]  http://thishost/otherpath/pathinfo
-                                                via external redirection
-
-^localpath(.*) http://thishost/otherpath$1 [P]  doesn't make sense, not supported
-----------------------------------------------  ----------------------------------
-^localpath(.*) http://otherhost/otherpath$1     http://otherhost/otherpath/pathinfo
-                                                via external redirection
-
-^localpath(.*) http://otherhost/otherpath$1 [R] http://otherhost/otherpath/pathinfo
-                                                via external redirection
-                                                (the [R] flag is redundant)
+<table class="bordered"><tr class="header">
+<th>Given Rule</th>
+<th>Resulting Substitution</th>
+</tr>
+<tr>
+<td>^localpath(.*) otherpath$1</td>
+<td>/somepath/otherpath/pathinfo</td>
+</tr>
+<tr class="odd">
+<td>^localpath(.*) otherpath$1  [R]</td>
+<td>http://thishost/somepath/otherpath/pathinfo via external
+redirection</td>
+</tr>
+<tr>
+<td>^localpath(.*) otherpath$1  [P]</td>
+<td>doesn't make sense, not supported</td>
+</tr>
+<tr class="odd">
+<td>^localpath(.*) /otherpath$1</td>
+<td>/otherpath/pathinfo</td>
+</tr>
+<tr>
+<td>^localpath(.*) /otherpath$1 [R]</td>
+<td>http://thishost/otherpath/pathinfo via external redirection</td>
+</tr>
+<tr class="odd">
+<td>^localpath(.*) /otherpath$1 [P]</td>
+<td>doesn't make sense, not supported</td>
+</tr>
+<tr>
+<td>^localpath(.*) http://thishost/otherpath$1</td>
+<td>/otherpath/pathinfo</td>
+</tr>
+<tr class="odd">
+<td>^localpath(.*) http://thishost/otherpath$1 [R]</td>
+<td>http://thishost/otherpath/pathinfo via external redirection</td>
+</tr>
+<tr>
+<td>^localpath(.*) http://thishost/otherpath$1 [P]</td>
+<td>doesn't make sense, not supported</td>
+</tr>
+<tr class="odd">
+<td>^localpath(.*) http://otherhost/otherpath$1</td>
+<td>http://otherhost/otherpath/pathinfo via external redirection</td>
+</tr>
+<tr>
+<td>^localpath(.*) http://otherhost/otherpath$1 [R]</td>
+<td>http://otherhost/otherpath/pathinfo via external redirection (the [R] flag is redundant)</td>
+</tr>
+<tr class="odd">
+<td>^localpath(.*) http://otherhost/otherpath$1 [P]</td>
+<td>http://otherhost/otherpath/pathinfo via internal proxy</td>
+</tr>
+</table>
 
-^localpath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
-                                                via internal proxy
-</pre></div>
   
 </div>
 </div>
 <div class="bottomlang">
 <p><span>Available Languages: </span><a href="../en/mod/mod_rewrite.html" title="English">&nbsp;en&nbsp;</a> |
 <a href="../fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a></p>
-</div><div id="footer">
-<p class="apache">Copyright 2010 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
-<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
+</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
+<script type="text/javascript"><!--//--><![CDATA[//><!--
+var comments_shortname = 'httpd';
+var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_rewrite.html';
+(function(w, d) {
+    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
+        d.write('<div id="comments_thread"><\/div>');
+        var s = d.createElement('script');
+        s.type = 'text/javascript';
+        s.async = true;
+        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
+        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
+    }
+    else {
+        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
+    }
+})(window, document);
+//--><!]]></script></div><div id="footer">
+<p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
+<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
+if (typeof(prettyPrint) !== 'undefined') {
+    prettyPrint();
+}
+//--><!]]></script>
 </body></html>
\ No newline at end of file