You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/03/30 10:46:17 UTC

svn commit: r1307308 - /httpd/httpd/trunk/docs/manual/expr.xml

Author: humbedooh
Date: Fri Mar 30 08:46:16 2012
New Revision: 1307308

URL: http://svn.apache.org/viewvc?rev=1307308&view=rev
Log:
Add some examples of how expressions might be used.
This should probably be extended at some point.

Modified:
    httpd/httpd/trunk/docs/manual/expr.xml

Modified: httpd/httpd/trunk/docs/manual/expr.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/expr.xml?rev=1307308&r1=1307307&r2=1307308&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/expr.xml (original)
+++ httpd/httpd/trunk/docs/manual/expr.xml Fri Mar 30 08:46:16 2012
@@ -471,6 +471,33 @@ listfunction ::= listfuncname "<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>
 



Re: svn commit: r1307308 - /httpd/httpd/trunk/docs/manual/expr.xml

Posted by Rich Bowen <rb...@rcbowen.com>.
On Mar 30, 2012, at 4:46 AM, humbedooh@apache.org wrote:

> URL: http://svn.apache.org/viewvc?rev=1307308&view=rev
> Log:
> Add some examples of how expressions might be used.
> This should probably be extended at some point.

Yeah, I have a notion that we eventually want an expr guide in much the same way that we have a rewrite guide.

--
Rich Bowen
rbowen@rcbowen.com :: @rbowen
rbowen@apache.org