]> granicus.if.org Git - apache/commitdiff
xform
authorEric Covener <covener@apache.org>
Sun, 31 Dec 2017 16:12:24 +0000 (16:12 +0000)
committerEric Covener <covener@apache.org>
Sun, 31 Dec 2017 16:12:24 +0000 (16:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1819740 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_substitute.html.en

index b5f9ad2567721026ba28fec234e5cc1b821b680b..b373cc130a808fef5b33d42cdfd4bf4e3946d2e0 100644 (file)
@@ -58,6 +58,7 @@
 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_substitute</td></tr>
+<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>expr= substitution values were added in 2.5.1</td></tr>
 </table>
     <p>The <code class="directive">Substitute</code> directive specifies a
     search and replace pattern to apply to the response body.</p>
         or regex of a subsequent one.</dd>
     </dl>
 
-    <p>The <var>substitution</var> is may contain literal text and regular
-    expression backreferences</p>
+    <p>The <var>substitution</var> may contain literal text and regular
+    expression backreferences. If the substitution begins with the text 
+    <code>expr=</code> it is intepreted as an <a href="../expr.html">
+    expression</a> which allows access to environment variables and
+    header values.  </p>
 
     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">&lt;Location "/"&gt;
     AddOutputFilterByType SUBSTITUTE text/html
 &lt;/Location&gt;</pre>
 </div>
 
+    <p> When using an <a href="../expr.html">expression</a> for the 
+    <var>substitution</var>, regular expression backreferencwa must be 
+    backslash ('\') escaped as illustrated in the example below:</p> 
+    <div class="example"><h3>Expression Example</h3><pre class="prettyprint lang-config">&lt;Location "/"&gt;
+    AddOutputFilterByType SUBSTITUTE text/html
+    Substitute "s/example.com/expr=%{HTTP:HOST}/i"
+    Substitute "s/Hello, (\S+)/expr=Hello from %{REQUEST_URI}, \$1,/i"
+&lt;/Location&gt;</pre>
+</div>
+
+
+
     <p>A common use scenario for <code>mod_substitute</code> is the
     situation in which a front-end server proxies requests to a back-end
     server which returns HTML with hard-coded embedded URLs that refer