]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Add some examples of how expressions might be used.
authorDaniel Gruno <humbedooh@apache.org>
Fri, 30 Mar 2012 08:46:16 +0000 (08:46 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Fri, 30 Mar 2012 08:46:16 +0000 (08:46 +0000)
This should probably be extended at some point.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1307308 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/expr.xml

index bdb3e687bd31be5429dcfb8aeb6e549e7e30f9ab..8d3165d47b4419160e8ef7285db45d184dd3acf3 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>