]> granicus.if.org Git - apache/commitdiff
Merge r1307308 from trunk:
authorDaniel Gruno <humbedooh@apache.org>
Fri, 30 Mar 2012 08:48:54 +0000 (08:48 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Fri, 30 Mar 2012 08:48:54 +0000 (08:48 +0000)
Add some examples of how expressions might be used.
This should probably be extended at some point.

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

docs/manual/expr.xml

index 53ab6fb39398d0efafc502d254c61fea6d40c8a0..3f091d2af431d116ffa03c475d44fbb5222a7585 100644 (file)
@@ -471,6 +471,33 @@ listfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
 
 </section>
 
+<section id="examples">
+    
+       <title>Example expressions</title>
+       <p>The following examples show how expressions might be used to evaluate requests:</p>
+       <!-- This section should probably be extended with more, useful examples -->
+       <example>
+       # Compare the host name to example.com and redirect to www.example.com if it matches<br />
+       &lt;If "%{HTTP_HOST} == 'example.com'"&gt;<br />
+       <indent>
+               Redirect permanent / http://www.example.com<br />
+       </indent>
+       &lt;/If&gt;<br /><br />
+       # Force text/plain if requesting a file with the query string contains 'forcetext'<br />
+       &lt;If "%{QUERY_STRING} =~ /forcetext/"&gt;<br />
+       <indent>
+               ForceType text/plain<br />
+       </indent>
+       &lt;/If&gt;<br /><br />
+       # Only allow access to this content during business hours<br />
+       &lt;Directory "/foo/bar/business"&gt;<br />
+       <indent>
+               Require expr %{TIME_HOUR} &gt;= 9 &amp;&amp; %{TIME_HOUR} &lt;= 17 <br />
+       </indent>
+       &lt;/Directory&gt;      
+       </example>
+</section>
+
 <section id="other">
     <title>Other</title>