From: Daniel Gruno Date: Fri, 30 Mar 2012 08:48:54 +0000 (+0000) Subject: Merge r1307308 from trunk: X-Git-Tag: 2.4.2~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=373b57d0a68efdf734f0c3cc1bd57e25177ee91f;p=apache Merge r1307308 from trunk: 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 --- diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index 53ab6fb393..3f091d2af4 100644 --- a/docs/manual/expr.xml +++ b/docs/manual/expr.xml @@ -471,6 +471,33 @@ listfunction ::= listfuncname "(" word ")" +
+ + Example expressions +

The following examples show how expressions might be used to evaluate requests:

+ + + # Compare the host name to example.com and redirect to www.example.com if it matches
+ <If "%{HTTP_HOST} == 'example.com'">
+ + Redirect permanent / http://www.example.com
+
+ </If>

+ # Force text/plain if requesting a file with the query string contains 'forcetext'
+ <If "%{QUERY_STRING} =~ /forcetext/">
+ + ForceType text/plain
+
+ </If>

+ # Only allow access to this content during business hours
+ <Directory "/foo/bar/business">
+ + Require expr %{TIME_HOUR} >= 9 && %{TIME_HOUR} <= 17
+
+ </Directory> +
+
+
Other