]> granicus.if.org Git - apache/commitdiff
Fix doc as spotted by Mark Brooks in online doc
authorChristophe Jaillet <jailletc36@apache.org>
Thu, 14 Apr 2016 09:41:17 +0000 (09:41 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Thu, 14 Apr 2016 09:41:17 +0000 (09:41 +0000)
Synch with trunk (r1468709 and r1481364)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1739042 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/rewrite/rewritemap.xml

index 2c7186645b2f0811afecda42b4c5edbf3e2f2342..c8fcdc245780845f17d1b602597e57c399753521 100644 (file)
@@ -84,16 +84,16 @@ RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
       substituted by <em>DefaultValue</em> or by the empty string
       if no <em>DefaultValue</em> was specified.</p>
 
-    <p>For example, you might define a
+    <p>For example, you can define a
       <directive>RewriteMap</directive> as:</p>
     <highlight language="config">
 RewriteMap examplemap "txt:/path/to/file/map.txt"
     </highlight>
     <p>You would then be able to use this map in a
       <directive>RewriteRule</directive> as follows:</p>
-<highlight language="config">
+      <highlight language="config">
 RewriteRule "^/ex/(.*)" "${examplemap:$1}"
-</highlight>
+      </highlight>
 
 <p>A default value can be specified in the event that nothing is found
 in the map:</p>
@@ -117,28 +117,72 @@ once created, in your <code>RewriteRule</code> and
 may be used, and give examples of each.</p>
   </section>
 
+  <section id="int">
+    <title>int: Internal Function</title>
+
+    <p>When a MapType of <code>int</code> is used, the MapSource is one
+    of the available internal RewriteMap functions.  Module authors can provide
+    additional internal functions by registering them with the
+    <code>ap_register_rewrite_mapfunc</code> API.
+    The functions that are provided by default are:
+    </p>
+
+    <ul>
+      <li><strong>toupper</strong>:<br/>
+             Converts the key to all upper case.</li>
+      <li><strong>tolower</strong>:<br/>
+             Converts the key to all lower case.</li>
+      <li><strong>escape</strong>:<br/>
+             Translates special characters in the key to
+            hex-encodings.</li>
+      <li><strong>unescape</strong>:<br/>
+             Translates hex-encodings in the key back to
+            special characters.</li>
+    </ul>
+
+    <p>
+    To use one of these functions, create a <code>RewriteMap</code> referencing
+    the int function, and then use that in your <code>RewriteRule</code>:
+    </p>
+
+   <p> <strong>Redirect a URI to an all-lowercase version of itself</strong></p>
+    <highlight language="config">
+
+RewriteMap lc int:tolower
+RewriteRule "(.*)" "${lc:$1}" [R]
+    </highlight>
+
+    <note>
+    <p>Please note that the example offered here is for
+    illustration purposes only, and is not a recommendation. If you want
+    to make URLs case-insensitive, consider using
+    <module>mod_speling</module> instead.
+    </p>
+    </note>
+
+  </section>
+
   <section id="txt">
     <title>txt: Plain text maps</title>
 
     <p>When a MapType of <code>txt</code> is used, the MapSource is a filesystem path to a
-    plain-text mapping file, containing space-separated key/value pair
-    per line. Optionally, a line may be contain a comment, starting with
+    plain-text mapping file, containing one space-separated key/value pair
+    per line. Optionally, a line may contain a comment, starting with
     a '#' character.</p>
 
-    <p>For example, the following might be valid entries in a map
-    file.</p>
+    <p>A valid text rewrite map file will have the following syntax:</p>
 
-    <p class="indent">
+    <example>
       # Comment line<br />
       <strong><em>MatchingKey</em> <em>SubstValue</em></strong><br />
       <strong><em>MatchingKey</em> <em>SubstValue</em></strong> # comment<br />
-    </p>
+    </example>
 
     <p>When the RewriteMap is invoked the argument is looked for in the
     first argument of a line, and, if found, the substitution value is
     returned.</p>
 
-    <p>For example, we might use a mapfile to translate product names to
+    <p>For example, we can use a mapfile to translate product names to
     product IDs for easier-to-remember URLs, using the following
     recipe:</p>
 <p><strong>Product to ID configuration</strong></p>
@@ -177,7 +221,7 @@ telephone  328
     pattern in order for it to match anything:
     <highlight language="config">
 RewriteRule "^product/(.*)" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]
-</highlight>
+    </highlight>
     </note>
 
     <note><title>Cached lookups</title>
@@ -199,7 +243,7 @@ RewriteRule "^product/(.*)" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]
     One of these values will be chosen at random if the key is
     matched.</p>
 
-    <p>For example, you might use the following map
+    <p>For example, you can use the following map
     file and directives to provide a random load balancing between
     several back-end servers, via a reverse-proxy. Images are sent
     to one of the servers in the 'static' pool, while everything
@@ -217,8 +261,8 @@ dynamic  www5|www6
     <highlight language="config">
 RewriteMap servers "rnd:/path/to/file/map.txt"
 
-RewriteRule "^/(.*\.(png|gif|jpg))" "http://${servers:static}/$1" [NC,P,L]
-RewriteRule "^/(.*)" "http://${servers:dynamic}/$1" [P,L]
+RewriteRule "^/(.*\.(png|gif|jpg))" "http://${servers:static}/$1"  [NC,P,L]
+RewriteRule "^/(.*)"                "http://${servers:dynamic}/$1" [P,L]
     </highlight>
 
     <p>So, when an image is requested and the first of these rules is
@@ -294,51 +338,6 @@ by many requests.
 
   </section>
 
-  <section id="int">
-    <title>int: Internal Function</title>
-
-    <p>When a MapType of <code>int</code> is used, the MapSource is one
-    of the available internal RewriteMap functions.  Module authors can provide
-    additional internal functions by registering them with the
-    <code>ap_register_rewrite_mapfunc</code> API.
-    The functions that are provided by default are:
-    </p>
-
-    <ul>
-      <li><strong>toupper</strong>:<br/>
-             Converts the key to all upper case.</li>
-      <li><strong>tolower</strong>:<br/>
-             Converts the key to all lower case.</li>
-      <li><strong>escape</strong>:<br/>
-             Translates special characters in the key to
-            hex-encodings.</li>
-      <li><strong>unescape</strong>:<br/>
-             Translates hex-encodings in the key back to
-            special characters.</li>
-    </ul>
-
-    <p>
-    To use one of these functions, create a <code>RewriteMap</code> referencing
-    the int function, and then use that in your <code>RewriteRule</code>:
-    </p>
-
-   <p> <strong>Redirect a URI to an all-lowercase version of itself</strong></p>
-    <highlight language="config">
-
-RewriteMap lc int:tolower
-RewriteRule "(.*)" "${lc:$1}" [R]
-    </highlight>
-
-    <note>
-    <p>Please note that the example offered here is for
-    illustration purposes only, and is not a recommendation. If you want
-    to make URLs case-insensitive, consider using
-    <module>mod_speling</module> instead.
-    </p>
-    </note>
-
-  </section>
-
   <section id="prg"><title>prg: External Rewriting Program</title>
 
     <p>When a MapType of <code>prg</code> is used, the MapSource is a
@@ -367,10 +366,9 @@ RewriteRule "(.*)" "${lc:$1}" [R]
 
     <p>A simple example is shown here which will replace all dashes with
     underscores in a request URI.</p>
-    
+
 <p><strong>Rewrite configuration</strong></p>
     <highlight language="config">
-
 RewriteMap d2u "prg:/www/bin/dash2under.pl"<br />
 RewriteRule "-" "${d2u:%{REQUEST_URI}}"
     </highlight>