]> granicus.if.org Git - apache/blobdiff - docs/manual/mod/mod_rewrite.html.en
move es and fr targets to *.utf8 extension. Update transformation
[apache] / docs / manual / mod / mod_rewrite.html.en
index 3015eb1e5bf828cc7918812402328835847d632a..dd1b94ac273b8c8c7f46e2eb8a5369784cd82943 100644 (file)
@@ -1,15 +1,17 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
+<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
+<!--
         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
               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 rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
-<script src="../style/scripts/prettify.js" type="text/javascript">
+<script src="../style/scripts/prettify.min.js" type="text/javascript">
 </script>
 
 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
@@ -17,7 +19,7 @@
 <div id="page-header">
 <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>
+<img alt="" src="../images/feather.png" /></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.5</a> &gt; <a href="./">Modules</a></div>
@@ -54,7 +56,10 @@ URLs on the fly</td></tr>
       <p>Further details, discussion, and examples, are provided in the
       <a href="../rewrite/">detailed mod_rewrite documentation</a>.</p>
 </div>
-<div id="quickview"><h3 class="directives">Directives</h3>
+<div id="quickview"><h3>Topics</h3>
+<ul id="topics">
+<li><img alt="" src="../images/down.gif" /> <a href="#logging">Logging</a></li>
+</ul><h3 class="directives">Directives</h3>
 <ul id="toc">
 <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>
@@ -63,13 +68,12 @@ URLs on the fly</td></tr>
 <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>
+<h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_rewrite">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_rewrite">Report a bug</a></li></ul><h3>See also</h3>
+<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>
+<h2><a name="logging" id="logging">Logging</a><a title="Permanent link" href="#logging" class="permalink">&para;</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
@@ -84,9 +88,7 @@ URLs on the fly</td></tr>
       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 class="example"><h3>Example</h3><pre class="prettyprint lang-config">LogLevel alert rewrite:trace3</pre>
 </div>
 
     <div class="note"><h3>RewriteLog</h3>
@@ -106,7 +108,7 @@ URLs on the fly</td></tr>
 
 </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>
+<div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a><a title="Permanent link" href="#rewritebase" class="permalink">&para;</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the base URL for per-directory rewrites</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteBase <em>URL-path</em></code></td></tr>
@@ -117,47 +119,51 @@ URLs on the fly</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 specifies the
-      URL prefix to be used for per-directory (htaccess) 
-      <code class="directive">RewriteRule</code> directives that substitute a relative
-      path.</p>
+      URL prefix to be used for per-directory (htaccess)
+      <code class="directive"><a href="#rewriterule">RewriteRule</a></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
+      in a substitution in per-directory (htaccess) context unless any 
       of the following conditions are true:</p>
       <ul>
-          <li> The original request, and the substitution, are underneath the 
+          <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 
+               (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 
+               <code class="directive"><a href="#rewriterule">RewriteRule</a></code>,
+               suffixed by the relative
+               substitution is also valid as a URL path on the server
                (this is rare).</li>
+          <li> In Apache HTTP Server 2.4.16 and later, this directive may be
+                omitted when the request is mapped via
+                <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>
+                or <code class="module"><a href="../mod/mod_userdir.html">mod_userdir</a></code>.</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 
+    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;
+<pre class="prettyprint lang-config">DocumentRoot "/var/www/example.com"
+AliasMatch "^/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>
+    RewriteBase "/myapp/"
+    RewriteRule "^index\.html$"  "welcome.html"
+&lt;/Directory&gt;</pre>
+
 
 
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2>
+<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a><a title="Permanent link" href="#rewritecond" class="permalink">&para;</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a condition under which rewriting will take place
 </td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> RewriteCond
-      <em>TestString</em> <em>CondPattern</em></code></td></tr>
+      <em>TestString</em> <em>CondPattern</em> [<em>flags</em>]</code></td></tr>
 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
@@ -213,26 +219,30 @@ Alias /myapp /opt/myapp-1.2.3
 
             <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 />
@@ -245,9 +255,11 @@ Alias /myapp /opt/myapp-1.2.3
             <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 />
@@ -266,12 +278,14 @@ Alias /myapp /opt/myapp-1.2.3
 
               <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>
@@ -280,25 +294,16 @@ Alias /myapp /opt/myapp-1.2.3
                 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.</p>
+                Most are documented <a href="../expr.html#vars">here</a>
+                or elsewhere in the Manual or in the CGI specification.</p>
 
                 <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">
+                <p>Those that are special to <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> include those below.</p>
                 <dl>
-                  <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>API_VERSION</code></dt>
 
                   <dd>This is the version of the Apache httpd module API
@@ -310,21 +315,30 @@ Alias /myapp /opt/myapp-1.2.3
                   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.  This value has not been unescaped
-                  (decoded), unlike most other variables below.</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 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>
+                  <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>
 
@@ -333,27 +347,35 @@ Alias /myapp /opt/myapp-1.2.3
                   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 
+                  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 
+                  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>
-
-                  <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>REQUEST_SCHEME</code></dt>
 
                   <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 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>
 
@@ -401,7 +423,9 @@ Alias /myapp /opt/myapp-1.2.3
         <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> is loaded, but will always expand to
         the empty string if it is not.  Example:
         <code>%{SSL:SSL_CIPHER_USEKEYSIZE}</code> may expand to
-        <code>128</code>.</li>
+        <code>128</code>. These variables are available even without
+        setting the <code>StdEnvVars</code> option of the
+        <code class="directive"><a href="../mod/mod_ssl.html#ssloptions">SSLOptions</a></code> directive.</li>
 
         <li>
         <code>%{HTTP:header}</code>, where <em>header</em> can be
@@ -411,7 +435,7 @@ Alias /myapp /opt/myapp-1.2.3
         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>
@@ -420,7 +444,8 @@ Alias /myapp /opt/myapp-1.2.3
         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
@@ -430,9 +455,9 @@ Alias /myapp /opt/myapp-1.2.3
         per-server context (<code>httpd.conf</code> file) you must
         use <code>%{LA-U:REMOTE_USER}</code> - this
         variable is set by the authorization phases, which come
-        <em>after</em> the URL translation phase (during which mod_rewrite
-        operates).</p>
-        <p>On the other hand, because mod_rewrite implements
+        <em>after</em> the URL translation phase (during which
+        <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> operates).</p>
+        <p>On the other hand, because <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> implements
         its per-directory context (<code>.htaccess</code> file) via
         the Fixup phase of the API and because the authorization
         phases come <em>before</em> this phase, you just can use
@@ -458,165 +483,195 @@ Alias /myapp /opt/myapp-1.2.3
 
       <ol>
         <li>You can prefix the pattern string with a
-        '<code>!</code>' character (exclamation mark) to specify a
-        <strong>non</strong>-matching pattern.</li>
+        '<code>!</code>' character (exclamation mark) to negate the result
+        of the condition, no matter what kind of <em>CondPattern</em> is used.
+        </li>
 
         <li>
           You can perform lexicographical string comparisons:
 
-          <ul>
-            <li>'<strong>&lt;CondPattern</strong>' (lexicographically
-            precedes)<br />
+          <dl>
+            <dt><strong>&lt;CondPattern</strong></dt>
+            <dd>Lexicographically precedes<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>.</li>
+            <em>CondPattern</em>.</dd>
 
-            <li>'<strong>&gt;CondPattern</strong>' (lexicographically
-            follows)<br />
+            <dt><strong>&gt;CondPattern</strong></dt>
+            <dd>Lexicographically follows<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>.</li>
+            <em>CondPattern</em>.</dd>
 
-            <li>'<strong>=CondPattern</strong>' (lexicographically
-            equal)<br />
+            <dt><strong>=CondPattern</strong></dt>
+            <dd>Lexicographically equal<br />
             Treats the <em>CondPattern</em> as a plain string and
             compares it lexicographically to <em>TestString</em>. True if
             <em>TestString</em> is lexicographically equal to
             <em>CondPattern</em> (the two strings are exactly
             equal, character for character). If <em>CondPattern</em>
             is <code>""</code> (two quotation marks) this
-            compares <em>TestString</em> to the empty string.</li>
+            compares <em>TestString</em> to the empty string.</dd>
 
-            <li>'<strong>&lt;=CondPattern</strong>' (lexicographically
-            less than or equal to)<br />
+            <dt><strong>&lt;=CondPattern</strong></dt>
+            <dd>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>
+            (the two strings are equal, character for character).</dd>
 
-            <li>'<strong>&gt;=CondPattern</strong>' (lexicographically
-            greater than or equal to)<br />
+            <dt><strong>&gt;=CondPattern</strong></dt>
+            <dd>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>
+            (the two strings are equal, character for character).</dd>
+        </dl>
+        </li>
 
         <li>
           You can perform integer comparisons:
-          <ul>
+          <dl>
 
-            <li>'<strong>-eq</strong>' (is numerically
-            <strong>eq</strong>ual to)<br />
+            <dt><strong>-eq</strong></dt>
+            <dd>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>
+            the two are numerically equal.</dd>
 
-            <li>'<strong>-ge</strong>' (is numerically
-            <strong>g</strong>reater than or <strong>e</strong>qual to)<br />
+            <dt><strong>-ge</strong></dt>
+            <dd>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>
+            to the <em>CondPattern</em>.</dd>
 
-             <li>'<strong>-gt</strong>' (is numerically
-            <strong>g</strong>reater <strong>t</strong>han)<br />
+            <dt><strong>-gt</strong></dt>
+            <dd>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>
+            the <em>CondPattern</em>.</dd>
 
-            <li>'<strong>-le</strong>' (is numerically
-            <strong>l</strong>ess than or <strong>e</strong>qual to)<br />
+            <dt><strong>-le</strong></dt>
+            <dd>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>
+            <strong>-h</strong> variant.</dd>
 
-             <li>'<strong>-lt</strong>' (is numerically
-            <strong>l</strong>ess <strong>t</strong>han)<br />
+            <dt><strong>-lt</strong></dt>
+            <dd>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>
+            <strong>-h</strong> variant.</dd>
+
+            <dt><strong>-ne</strong></dt>
+            <dd>Is numerically <strong>n</strong>ot <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 two are numerically different. This is equivalent to
+            <code>!-eq</code>.</dd>
 
-           </ul>
+           </dl>
         </li>
 
         <li>You can perform various file attribute tests:
-          <ul>
-            <li>'<strong>-d</strong>' (is
-            <strong>d</strong>irectory)<br />
+
+
+          <dl>
+
+          <dt><strong>-d</strong></dt>
+
+          <dd>Is <strong>d</strong>irectory.<br />
              Treats the <em>TestString</em> as a pathname and tests
-            whether or not it exists, and is a directory.</li>
+            whether or not it exists, and is a directory.
+          </dd>
+
+          <dt><strong>-f</strong></dt>
+
+          <dd>Is regular <strong>f</strong>ile.<br />
 
-            <li>'<strong>-f</strong>' (is regular
-            <strong>f</strong>ile)<br />
              Treats the <em>TestString</em> as a pathname and tests
-            whether or not it exists, and is a regular file.</li>
+            whether or not it exists, and is a regular file.
+        </dd>
 
-            <li>'<strong>-F</strong>' (is existing file, via
-            subrequest)<br />
+           <dt><strong>-F</strong></dt>
+
+           <dd>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>
+            it can impact your server's performance!
+           </dd>
+
+            <dt><strong>-h</strong></dt>
+            <dd>Is symbolic link, bash convention.<br />
+            See <strong>-l</strong>.
+            </dd>
 
-            <li>'<strong>-H</strong>' (is symbolic link, bash convention)<br />
-            See <strong>-l</strong>.</li>
+            <dt><strong>-l</strong></dt>
 
-            <li>'<strong>-l</strong>' (is symbolic
-            <strong>l</strong>ink)<br />
+            <dd>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>
+            <strong>-le</strong> tests.
+            </dd>
 
-            <li>'<strong>-L</strong>' (is symbolic link, bash convention)<br />
-            See <strong>-l</strong>.</li>
+            <dt><strong>-L</strong></dt>
+            <dd>Is symbolic link, bash convention.<br />
+            See <strong>-l</strong>.</dd>
 
-            <li>'<strong>-s</strong>' (is regular file, with
-            <strong>s</strong>ize)<br />
+            <dt><strong>-s</strong></dt>
+            <dd>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>
+            than zero.</dd>
 
-            <li>'<strong>-U</strong>' (is existing URL, via
-            subrequest)<br />
+            <dt><strong>-U</strong></dt>
+            <dd><p>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>
-
-            <li>'<strong>-x</strong>' (has e<strong>x</strong>ecutable
-            permissions)<br />
+            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> </dd>
+
+            <dt><strong>-x</strong></dt>
+            <dd>Has e<strong>x</strong>ecutable permissions.<br />
             Treats the <em>TestString</em> as a pathname and tests
             whether or not it exists, and has executable permissions.
             These permissions are determined according to
-            the underlying OS.</li>
+            the underlying OS.</dd>
+
+          </dl>
+
+          For example:
+
+        <pre class="prettyprint lang-config">RewriteCond /var/www/%{REQUEST_URI} !-f
+RewriteRule ^(.+) /other/archive/$1 [R]</pre>
 
-          </ul>
 
-<div class="note"><h3>Note:</h3>
-              All of these tests can
-              also be prefixed by an exclamation mark ('!') to
-              negate their meaning.
-</div>
         </li>
 
-       <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>
@@ -627,20 +682,18 @@ Alias /myapp /opt/myapp-1.2.3
             to block unwanted hotlinking.
            </p>
 
-           <pre class="prettyprint lang-config">
-           RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"<br />
-           RewriteRule ^/images - [F]
-           </pre>
+           <pre class="prettyprint lang-config">RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"
+RewriteRule "^/images" "-" [F]</pre>
 
         </li>
+     </ol>
 
-        <li>You can also set special flags for
-      <em>CondPattern</em> by appending
+     <p>You can also set special flags for <em>CondPattern</em> by appending
         <strong><code>[</code><em>flags</em><code>]</code></strong>
-      as the third argument to the <code>RewriteCond</code>
+      as the third argument to the <code class="directive">RewriteCond</code>
       directive, where <em>flags</em> is a comma-separated list of any of the
-      following flags:
-
+      following flags:</p>
+      
       <ul>
         <li>'<strong><code>nocase|NC</code></strong>'
         (<strong>n</strong>o <strong>c</strong>ase)<br />
@@ -657,12 +710,10 @@ Alias /myapp /opt/myapp-1.2.3
           Use this to combine rule conditions with a local OR
           instead of the implicit AND. Typical example:
 
-<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>
+<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
@@ -679,8 +730,6 @@ RewriteRule ...some special stuff for any of these hosts...
         is well understood.
         </li>
       </ul>
-      </li>
-     </ol>
 
       <p><strong>Example:</strong></p>
 
@@ -688,32 +737,22 @@ RewriteRule ...some special stuff for any of these hosts...
         ``<code>User-Agent:</code>'' header of the request, you can
         use the following: </p>
 
-<pre class="prettyprint lang-config">
-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>
 
 
         <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>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="directive-section"><h2><a name="RewriteEngine" id="RewriteEngine">RewriteEngine</a> <a name="rewriteengine" id="rewriteengine">Directive</a></h2>
+<div class="directive-section"><h2><a name="RewriteEngine" id="RewriteEngine">RewriteEngine</a> <a name="rewriteengine" id="rewriteengine">Directive</a><a title="Permanent link" href="#rewriteengine" class="permalink">&para;</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables or disables runtime rewriting engine</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteEngine on|off</code></td></tr>
@@ -730,7 +769,7 @@ 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 rules in a particular contact,
+      <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
@@ -738,21 +777,25 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       <code>RewriteEngine on</code> directive for each virtual host
       in which you wish to use rewrite rules.</p>
 
-      <p><code class="directive">RewriteMap</code> directives of the type <code>prg</code>
+      <p><code class="directive"><a href="#rewritemap">RewriteMap</a></code> directives
+      of the type <code>prg</code>
       are not started during server initialization if they're defined in a
-      context that does not have <code class="directive">RewriteEngine</code>  set to
+      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="RewriteMap" id="RewriteMap">RewriteMap</a> <a name="rewritemap" id="rewritemap">Directive</a></h2>
+<div class="directive-section"><h2><a name="RewriteMap" id="RewriteMap">RewriteMap</a> <a name="rewritemap" id="rewritemap">Directive</a><a title="Permanent link" href="#rewritemap" class="permalink">&para;</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a mapping function for key-lookup</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
+    [<em>MapTypeOptions</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>
+<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The 3rd parameter, MapTypeOptions, in only available from Apache
+2.4.29 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
@@ -785,18 +828,19 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       <p>For example, you might define a
       <code class="directive">RewriteMap</code> as:</p>
 
-      <pre class="prettyprint lang-config">
-      RewriteMap examplemap txt:/path/to/file/map.txt
-      </pre>
+      <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>
+      <code class="directive"><a href="#rewriterule">RewriteRule</a></code> as follows:</p>
+
+      <pre class="prettyprint lang-config">RewriteRule "^/ex/(.*)" "${examplemap:$1}"</pre>
 
-      <pre class="prettyprint lang-config">
-      RewriteRule ^/ex/(.*) ${examplemap:$1}
-      </pre>
 
+      <p>The meaning of the <em>MapTypeOptions</em> argument depends on
+      particular <em>MapType</em>. See the
+      <a href="../rewrite/rewritemap.html">Using RewriteMap</a> for
+      more information.</p>
 
       <p>The following combinations for <em>MapType</em> and
       <em>MapSource</em> can be used:</p>
@@ -835,7 +879,7 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
 
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="directive-section"><h2><a name="RewriteOptions" id="RewriteOptions">RewriteOptions</a> <a name="rewriteoptions" id="rewriteoptions">Directive</a></h2>
+<div class="directive-section"><h2><a name="RewriteOptions" id="RewriteOptions">RewriteOptions</a> <a name="rewriteoptions" id="rewriteoptions">Directive</a><a title="Permanent link" href="#rewriteoptions" class="permalink">&para;</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets some special options for the rewrite engine</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteOptions <var>Options</var></code></td></tr>
@@ -878,23 +922,52 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       <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.
+      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. Available in Apache HTTP Server 2.4.0 and
-      later.</p>
+      a trailing slash, if so desired.<br />
+      Available in Apache HTTP Server 2.4.0 and later.</p>
       </dd>
 
       <dt><code>AllowAnyURI</code></dt>
@@ -903,7 +976,7 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       <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
+      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>).
@@ -911,10 +984,11 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
       <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.</p>
+      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> 
+      <h3>Security Warning</h3>
 
       <p>Enabling this option will make the server vulnerable to
       security issues if used with rewrite rules which are not
@@ -931,15 +1005,52 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
 
       <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>. Available in 
-      Apache HTTP Server 2.5 and later only.</p>
+      <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>
+
+      <dt><code>IgnoreContextInfo</code></dt>
+      <dd>
+
+      <p>When a relative substitution is made
+         in directory (htaccess) context and <code class="directive"><a href="#rewritebase">RewriteBase</a></code> has not been set, this module uses some
+         extended URL and filesystem context information to change the
+         relative substitution back into a URL. Modules such as
+         <code class="module"><a href="../mod/mod_userdir.html">mod_userdir</a></code> and <code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code>
+         supply this extended context info.  Available in 2.4.16 and later.</p>
+      </dd>
+
+
+      <dt><code>LegacyPrefixDocRoot</code></dt>
+      <dd>
+
+      <p>Prior to 2.4.26, if a substitution was an absolute URL that matched
+         the current virtual host, the URL might first be reduced to a URL-path
+         and then later reduced to a local path. Since the URL can be reduced 
+         to a local path, the path should be prefixed with the document root. 
+         This prevents a file such as /tmp/myfile from being accessed when a 
+         request is made to http://host/file/myfile with the following 
+         <code class="directive"><a href="#rewriterule">RewriteRule</a></code>.</p>
+      <pre class="prettyprint lang-config">RewriteRule /file/(.*) http://localhost/tmp/$1</pre>
+
+      <p>This option allows the old behavior to be used where the document
+         root is not prefixed to a local path that was reduced from a 
+         URL.  Available in 2.4.26 and later.</p>
       </dd>
-      </dl>
 
+      <dt><code>LongURLOptimization</code></dt>
+      <dd>
+      <p>This option reduces memory usage of long, unoptimized rule sets 
+         that repeatedly expand long values in RewriteCond and RewriteRule
+         variables. Available in 2.5 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>
+<div class="directive-section"><h2><a name="RewriteRule" id="RewriteRule">RewriteRule</a> <a name="rewriterule" id="rewriterule">Directive</a><a title="Permanent link" href="#rewriterule" class="permalink">&para;</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines rules for the rewriting engine</td></tr>
 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteRule
@@ -957,28 +1068,40 @@ RewriteRule  ^/$                 /homepage.std.html  [L]
 
       <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 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>
+      expression</a>.  What this pattern is compared against varies depending
+      on where the <code class="directive">RewriteRule</code> directive is defined. </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>
+<ul>
+      <li><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").
+      This is the (%-decoded) <a href="directive-dict.html#Syntax">URL-path</a>.</p></li>
+
+      <li><p>In per-directory context (<code class="directive"><a href="../mod/core.html#directory">Directory</a></code> and .htaccess),
+      the <em>Pattern</em> is matched against only a partial path, for example a request
+      of "/app1/index.html" may result in comparison against "app1/index.html" 
+      or "index.html" depending on where the <code class="directive">RewriteRule</code> is 
+      defined.</p>
+
+      <p>The directory path where the rule is defined is stripped from the currently mapped
+      filesystem path before comparison (up to and including a trailing slash). 
+      The net result of this per-directory prefix stripping is that rules in
+      this context only match against the portion of the currently mapped filesystem path 
+      "below" where the rule is defined.</p>
+
+      <p>Directives such as <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> and <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code>, or even the 
+      result of previous <code class="directive">RewriteRule</code> substitutions, determine
+      the currently mapped filesystem path.  
+      </p>
+      </li>
 
-      <p>If you wish to match against the hostname, port, or query string, use a
+      <li><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.</p>
-
+      <code>%{QUERY_STRING}</code> variables respectively.</p></li>
+</ul>
 </div>
 
 <div class="note"><h3>Per-directory Rewrites</h3>
@@ -993,25 +1116,22 @@ 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>
+<li>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>
+a <code class="directive"><a href="#rewritecond">RewriteCond</a></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>
+<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
+(including their regular expression counterparts), this
+should never be necessary and is unsupported. A likely feature
+to break in these contexts is relative substitutions.</li>
 </ul>
 </div>
 
@@ -1020,7 +1140,7 @@ should never be necessary and is unsupported.</li>
       the <a href="../rewrite/intro.html#regex">mod_rewrite
       Introduction</a>.</p>
 
-      <p>In mod_rewrite, the NOT character
+      <p>In <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>, the NOT character
       ('<code>!</code>') is also available as a possible pattern
       prefix. This enables you to negate a pattern; to say, for instance:
       ``<em>if the current URL does <strong>NOT</strong> match this
@@ -1047,7 +1167,7 @@ cannot use <code>$N</code> in the substitution string!
 
         <dd>Designates the location on the file-system of the resource
         to be delivered to the client.  Substitutions are only
-        treated as a file-system path when the rule is configured in 
+        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>
 
@@ -1061,7 +1181,7 @@ 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 (or, in the case of 
+        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
@@ -1109,9 +1229,11 @@ cannot use <code>$N</code> in the substitution string!
       (<strong>N</strong>=0..9), which will be replaced
       by the contents of the <strong>N</strong>th group of the
       matched <em>Pattern</em>. The server-variables are the same
-      as for the <em>TestString</em> of a <code>RewriteCond</code>
+      as for the <em>TestString</em> of a
+      <code class="directive"><a href="#rewritecond">RewriteCond</a></code>
       directive. The mapping-functions come from the
-      <code>RewriteMap</code> directive and are explained there.
+      <code class="directive"><a href="#rewritemap">RewriteMap</a></code>
+      directive and are explained there.
       These three types of variables are expanded in the order above.</p>
 
       <p>Rewrite rules are applied to the results of previous rewrite
@@ -1138,137 +1260,151 @@ cannot use <code>$N</code> in the substitution string!
 
       <p>Additionally you can set special <a name="rewriteflags" id="rewriteflags">actions</a> to be performed by
       appending <strong><code>[</code><em>flags</em><code>]</code></strong>
-      as the third argument to the <code>RewriteRule</code>
+      as the third argument to the <code class="directive">RewriteRule</code>
       directive. <em>Flags</em> is a comma-separated list, surround by square
       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 class="bordered">
-    <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>
     </tr>
-    <tr>
+<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
         ...</a></em></td>
     </tr>
-    <tr>
+<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>
+        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 (see also the END flag). <em><a href="../rewrite/flags.html#flag_end">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 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 from the original request URL to 
+        <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>qslast|QSL</td>
+        <td>Interpret the last (right-most) question mark as the query string
+            delimiter, instead of the first (left-most) as normally used.  
+            Available in 2.4.19 and later.
+        <em><a href="../rewrite/flags.html#flag_qsl">details
+        ...</a></em></td>
+    </tr>
+<tr>
         <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>
-        <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_l">details ...</a></em></td>
-    </tr>
-    <tr>
+<tr class="odd">
         <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>
+<tr>
         <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
-resembling "/~user" (via explicit text or backreferences), mod_rewrite performs
+resembling "/~user" (via explicit text or backreferences), <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> performs
 home directory expansion independent of the presence or configuration
 of <code class="module"><a href="../mod/mod_userdir.html">mod_userdir</a></code>.</p>
 
@@ -1287,68 +1423,55 @@ directive.</p>
       /somepath/pathinfo</code>'':</strong><br />
       </p>
 
-<table class="bordered">
-<tr>
+<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>
+<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>
+<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>
+<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>
+<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>
+<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>
+<tr class="odd">
 <td>^/somepath(.*) http://otherhost/otherpath$1 [P]</td>
 <td>http://otherhost/otherpath/pathinfo via internal proxy</td>
 </tr>
@@ -1357,79 +1480,64 @@ directive.</p>
       <p><strong>Inside per-directory configuration for
       <code>/somepath</code><br />
        (<code>/physical/path/to/somepath/.htaccess</code>, with
-      <code>RewriteBase /somepath</code>)<br />
+      <code>RewriteBase "/somepath"</code>)<br />
        for request ``<code>GET
       /somepath/localpath/pathinfo</code>'':</strong><br />
      </p>
 
-<table class="bordered">
-
-<tr>
+<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>
+<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>
+<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>
+<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>
+<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>
+<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>
+<tr class="odd">
 <td>^localpath(.*) http://otherhost/otherpath$1 [P]</td>
 <td>http://otherhost/otherpath/pathinfo via internal proxy</td>
 </tr>
-
 </table>
 
   
@@ -1456,7 +1564,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_rewrite.ht
     }
 })(window, document);
 //--><!]]></script></div><div id="footer">
-<p class="apache">Copyright 2013 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="apache">Copyright 2018 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();