You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2010/05/19 00:55:44 UTC

svn commit: r945944 - in /httpd/httpd/trunk/docs/manual/rewrite: rewritemap.html.en rewritemap.xml

Author: rbowen
Date: Tue May 18 22:55:44 2010
New Revision: 945944

URL: http://svn.apache.org/viewvc?rev=945944&view=rev
Log:
Rephrasing of RewriteMap intro.

Modified:
    httpd/httpd/trunk/docs/manual/rewrite/rewritemap.html.en
    httpd/httpd/trunk/docs/manual/rewrite/rewritemap.xml

Modified: httpd/httpd/trunk/docs/manual/rewrite/rewritemap.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewritemap.html.en?rev=945944&r1=945943&r2=945944&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewritemap.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewritemap.html.en Tue May 18 22:55:44 2010
@@ -21,14 +21,17 @@
 <p><span>Available Languages: </span><a href="../en/rewrite/rewritemap.html" title="English">&nbsp;en&nbsp;</a></p>
 </div>
 
+
     <p>This document supplements the <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> 
 <a href="../mod/mod_rewrite.html">reference documentation</a>. It describes
 the use of the <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> directive,
 and provides examples of each of the various <code>RewriteMap</code> types.</p>
+
     <div class="warning">Note that many of these examples won't work unchanged in your
 particular server configuration, so it's important that you understand
 them, rather than merely cutting and pasting the examples into your
 configuration.</div>
+
   </div>
 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#introduction">Introduction</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#txt">txt: Plain text maps</a></li>
@@ -38,43 +41,50 @@ configuration.</div>
 <li><img alt="" src="../images/down.gif" /> <a href="#prg">prg: External Rewriting Program</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#dbd">dbd or fastdbd: SQL Query</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#summary">Summary</a></li>
-</ul><h3>See also</h3><ul class="seealso"><li> <a href="../mod/mod_rewrite.html">Module documentation</a> </li><li> <a href="intro.html">mod_rewrite introduction</a> </li><li> <a href="remapping.html">Redirection and remapping</a> </li><li> <a href="access.html">Controlling access</a> </li><li> <a href="vhosts.html">Virtual hosts</a> </li><li> <a href="proxy.html">Proxying</a> </li><li> <a href="advanced.html">Advanced techniques and tricks</a> </li><li> <a href="avoid.html">When not to use mod_rewrite</a> </li></ul></div>
+</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="access.html">Controlling access</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="proxy.html">Proxying</a></li><li><a href="advanced.html">Advanced techniques and tricks</a></li><li><a href="avoid.html">When not to use mod_rewrite</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="introduction" id="introduction">Introduction</a></h2>
     
-    <p>The <code class="directive">RewriteMap</code> directive defines a
-      <em>Rewriting Map</em> which can be used inside rule
-      substitution strings by the mapping-functions to
-      insert/substitute fields through a key lookup. The source of
-      this lookup can be of various types.</p>
-    <p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is
-      the name of the map and will be used to specify a
-      mapping-function for the substitution strings of a rewriting
-      rule via one of the following constructs:</p>
+
+   <p>
+   The <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> directive
+   defines an external function which can be called in the context of
+   <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> or
+   <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code> directives to
+   perform rewriting that is too complicated, or too specialized to be
+   performed just by regular expressions. The source of this lookup can
+   be any of the types listed in the sections below, and enumerated in
+   the <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code> reference
+   documentation.</p>
+
+   <p>The syntax of the <code>RewriteMap</code> directive is as
+   follows:</p>
+
+<div class="example"><p><code>
+RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
+</code></p></div>
+    
+    <p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is an
+    arbitray name that you assign to the map, and which you will use in
+    directives later on. Arguments are passed to the map via the
+    following syntax:</p>
+
     <p class="indent">
       <strong>
-        <code>${</code>
-        <em>MapName</em>
-        <code>:</code>
-        <em>LookupKey</em>
-        <code>}</code>
-        <br />
-        <code>${</code>
-        <em>MapName</em>
-        <code>:</code>
-        <em>LookupKey</em>
-        <code>|</code>
-        <em>DefaultValue</em>
-        <code>}</code>
+        <code>${</code> <em>MapName</em> <code>:</code> <em>LookupKey</em>
+        <code>}</code> <br /> <code>${</code> <em>MapName</em> <code>:</code>
+        <em>LookupKey</em> <code>|</code> <em>DefaultValue</em> <code>}</code>
       </strong>
     </p>
+
     <p>When such a construct occurs, the map <em>MapName</em> is
       consulted and the key <em>LookupKey</em> is looked-up. If the
       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>
+
     <p>For example, you might define a
       <code class="directive">RewriteMap</code> as:</p>
     <div class="example"><p><code>
@@ -85,8 +95,9 @@ configuration.</div>
     <div class="example"><p><code>
       RewriteRule ^/ex/(.*) ${examplemap:$1}
       </code></p></div>
-    <p>The following combinations for <em>MapType</em> and
-      <em>MapSource</em> can be used:</p>
+
+<p>The sections that follow describe the various <em>MapType</em>s that
+may be used, and give examples of each.</p>
   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="txt" id="txt">txt: Plain text maps</a></h2>
@@ -190,29 +201,30 @@ $ httxt2dbm -i mapfile.txt -o mapfile.ma
     </ul>
   </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="prg" id="prg">prg: External Rewriting Program</a></h2><p>
-           MapType: <code>prg</code>, MapSource: Unix filesystem
-          path to valid regular file
-          </p><p>Here the source is a program, not a map file. To
-          create it you can use a language of your choice, but
-          the result has to be an executable program (either
-          object-code or a script with the magic cookie trick
-          '<code>#!/path/to/interpreter</code>' as the first
-          line).</p><p>This program is started once, when the Apache httpd server
-          is started, and then communicates with the rewriting engine
-          via its <code>stdin</code> and <code>stdout</code>
-          file-handles. For each map-function lookup it will
-          receive the key to lookup as a newline-terminated string
-          on <code>stdin</code>. It then has to give back the
-          looked-up value as a newline-terminated string on
-          <code>stdout</code> or the four-character string
-          ``<code>NULL</code>'' if it fails (<em>i.e.</em>, there
-          is no corresponding value for the given key).</p><p>This feature utilizes the <code>rewrite-map</code> mutex,
-          which is required for reliable communication with the program.
-          The mutex mechanism and lock file can be configured with the
-          <code class="directive"><a href="../mod/core.html#mutex">Mutex</a></code> directive.</p><p>External rewriting programs are not started if they're defined in a
-          context that does not have <code class="directive">RewriteEngine</code> set to
-          <code>on</code></p>.
+<h2><a name="prg" id="prg">prg: External Rewriting Program</a></h2>
+  
+<p>MapType: <code>prg</code>, MapSource: Unix filesystem path to valid regular file </p>
+
+<p>Here the source is a program, not a map file. To
+create it you can use a language of your choice, but
+the result has to be an executable program (either
+object-code or a script with the magic cookie trick
+'<code>#!/path/to/interpreter</code>' as the first
+line).</p><p>This program is started once, when the Apache httpd server
+is started, and then communicates with the rewriting engine
+via its <code>stdin</code> and <code>stdout</code>
+file-handles. For each map-function lookup it will
+receive the key to lookup as a newline-terminated string
+on <code>stdin</code>. It then has to give back the
+looked-up value as a newline-terminated string on
+<code>stdout</code> or the four-character string
+``<code>NULL</code>'' if it fails (<em>i.e.</em>, there
+is no corresponding value for the given key).</p><p>This feature utilizes the <code>rewrite-map</code> mutex,
+which is required for reliable communication with the program.
+The mutex mechanism and lock file can be configured with the
+<code class="directive"><a href="../mod/core.html#mutex">Mutex</a></code> directive.</p><p>External rewriting programs are not started if they're defined in a
+context that does not have <code class="directive">RewriteEngine</code> set to
+<code>on</code></p>.
 
           <p>A trivial program which will implement a 1:1 map (<em>i.e.</em>,
           key == value) could be:</p><div class="example"><pre>

Modified: httpd/httpd/trunk/docs/manual/rewrite/rewritemap.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewritemap.xml?rev=945944&r1=945943&r2=945944&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewritemap.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewritemap.xml Tue May 18 22:55:44 2010
@@ -22,58 +22,68 @@
   <parentdocument href="./">Rewrite</parentdocument>
   <title>Using RewriteMap</title>
   <summary>
+
     <p>This document supplements the <module>mod_rewrite</module> 
 <a href="../mod/mod_rewrite.html">reference documentation</a>. It describes
 the use of the <directive module="mod_rewrite">RewriteMap</directive> directive,
 and provides examples of each of the various <code>RewriteMap</code> types.</p>
+
     <note type="warning">Note that many of these examples won't work unchanged in your
 particular server configuration, so it's important that you understand
 them, rather than merely cutting and pasting the examples into your
 configuration.</note>
+
   </summary>
-  <seealso> <a href="../mod/mod_rewrite.html">Module documentation</a> </seealso>
-  <seealso> <a href="intro.html">mod_rewrite introduction</a> </seealso>
-  <seealso> <a href="remapping.html">Redirection and remapping</a> </seealso>
-  <seealso> <a href="access.html">Controlling access</a> </seealso>
-  <seealso> <a href="vhosts.html">Virtual hosts</a> </seealso>
-  <seealso> <a href="proxy.html">Proxying</a> </seealso>
-  <seealso> <a href="advanced.html">Advanced techniques and tricks</a> </seealso>
-  <seealso> <a href="avoid.html">When not to use mod_rewrite</a> </seealso>
+  <seealso><a href="../mod/mod_rewrite.html">Module documentation</a></seealso>
+  <seealso><a href="intro.html">mod_rewrite introduction</a></seealso>
+  <seealso><a href="remapping.html">Redirection and remapping</a></seealso>
+  <seealso><a href="access.html">Controlling access</a></seealso>
+  <seealso><a href="vhosts.html">Virtual hosts</a></seealso>
+  <seealso><a href="proxy.html">Proxying</a></seealso>
+  <seealso><a href="advanced.html">Advanced techniques and tricks</a></seealso>
+  <seealso><a href="avoid.html">When not to use mod_rewrite</a></seealso>
 
   <section id="introduction">
     <title>Introduction</title>
-    <p>The <directive>RewriteMap</directive> directive defines a
-      <em>Rewriting Map</em> which can be used inside rule
-      substitution strings by the mapping-functions to
-      insert/substitute fields through a key lookup. The source of
-      this lookup can be of various types.</p>
-    <p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is
-      the name of the map and will be used to specify a
-      mapping-function for the substitution strings of a rewriting
-      rule via one of the following constructs:</p>
+
+   <p>
+   The <directive module="mod_rewrite">RewriteMap</directive> directive
+   defines an external function which can be called in the context of
+   <directive module="mod_rewrite">RewriteRule</directive> or
+   <directive module="mod_rewrite">RewriteCond</directive> directives to
+   perform rewriting that is too complicated, or too specialized to be
+   performed just by regular expressions. The source of this lookup can
+   be any of the types listed in the sections below, and enumerated in
+   the <directive module="mod_rewrite">RewriteMap</directive> reference
+   documentation.</p>
+
+   <p>The syntax of the <code>RewriteMap</code> directive is as
+   follows:</p>
+
+<example>
+RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
+</example>
+    
+    <p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is an
+    arbitray name that you assign to the map, and which you will use in
+    directives later on. Arguments are passed to the map via the
+    following syntax:</p>
+
     <p class="indent">
       <strong>
-        <code>${</code>
-        <em>MapName</em>
-        <code>:</code>
-        <em>LookupKey</em>
-        <code>}</code>
-        <br/>
-        <code>${</code>
-        <em>MapName</em>
-        <code>:</code>
-        <em>LookupKey</em>
-        <code>|</code>
-        <em>DefaultValue</em>
-        <code>}</code>
+        <code>${</code> <em>MapName</em> <code>:</code> <em>LookupKey</em>
+        <code>}</code> <br/> <code>${</code> <em>MapName</em> <code>:</code>
+        <em>LookupKey</em> <code>|</code> <em>DefaultValue</em> <code>}</code>
       </strong>
     </p>
+
     <p>When such a construct occurs, the map <em>MapName</em> is
       consulted and the key <em>LookupKey</em> is looked-up. If the
       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>
+
     <p>For example, you might define a
       <directive>RewriteMap</directive> as:</p>
     <example>
@@ -84,9 +94,11 @@ configuration.</note>
     <example>
       RewriteRule ^/ex/(.*) ${examplemap:$1}
       </example>
-    <p>The following combinations for <em>MapType</em> and
-      <em>MapSource</em> can be used:</p>
+
+<p>The sections that follow describe the various <em>MapType</em>s that
+may be used, and give examples of each.</p>
   </section>
+
   <section id="txt">
     <title>txt: Plain text maps</title>
     <p>MapType: <code>txt</code>, MapSource: Unix filesystem
@@ -190,29 +202,30 @@ $ httxt2dbm -i mapfile.txt -o mapfile.ma
             special characters.</li>
     </ul>
   </section>
-  <section id="prg"><title>prg: External Rewriting Program</title><p>
-           MapType: <code>prg</code>, MapSource: Unix filesystem
-          path to valid regular file
-          </p><p>Here the source is a program, not a map file. To
-          create it you can use a language of your choice, but
-          the result has to be an executable program (either
-          object-code or a script with the magic cookie trick
-          '<code>#!/path/to/interpreter</code>' as the first
-          line).</p><p>This program is started once, when the Apache httpd server
-          is started, and then communicates with the rewriting engine
-          via its <code>stdin</code> and <code>stdout</code>
-          file-handles. For each map-function lookup it will
-          receive the key to lookup as a newline-terminated string
-          on <code>stdin</code>. It then has to give back the
-          looked-up value as a newline-terminated string on
-          <code>stdout</code> or the four-character string
-          ``<code>NULL</code>'' if it fails (<em>i.e.</em>, there
-          is no corresponding value for the given key).</p><p>This feature utilizes the <code>rewrite-map</code> mutex,
-          which is required for reliable communication with the program.
-          The mutex mechanism and lock file can be configured with the
-          <directive module="core">Mutex</directive> directive.</p><p>External rewriting programs are not started if they're defined in a
-          context that does not have <directive>RewriteEngine</directive> set to
-          <code>on</code></p>.
+  <section id="prg"><title>prg: External Rewriting Program</title>
+  
+<p>MapType: <code>prg</code>, MapSource: Unix filesystem path to valid regular file </p>
+
+<p>Here the source is a program, not a map file. To
+create it you can use a language of your choice, but
+the result has to be an executable program (either
+object-code or a script with the magic cookie trick
+'<code>#!/path/to/interpreter</code>' as the first
+line).</p><p>This program is started once, when the Apache httpd server
+is started, and then communicates with the rewriting engine
+via its <code>stdin</code> and <code>stdout</code>
+file-handles. For each map-function lookup it will
+receive the key to lookup as a newline-terminated string
+on <code>stdin</code>. It then has to give back the
+looked-up value as a newline-terminated string on
+<code>stdout</code> or the four-character string
+``<code>NULL</code>'' if it fails (<em>i.e.</em>, there
+is no corresponding value for the given key).</p><p>This feature utilizes the <code>rewrite-map</code> mutex,
+which is required for reliable communication with the program.
+The mutex mechanism and lock file can be configured with the
+<directive module="core">Mutex</directive> directive.</p><p>External rewriting programs are not started if they're defined in a
+context that does not have <directive>RewriteEngine</directive> set to
+<code>on</code></p>.
 
           <p>A trivial program which will implement a 1:1 map (<em>i.e.</em>,
           key == value) could be:</p><example><pre>