From: Daniel Gruno Date: Fri, 30 Mar 2012 08:46:16 +0000 (+0000) Subject: Add some examples of how expressions might be used. X-Git-Tag: 2.5.0-alpha~7293 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52408a0fef109c74044ba35898483cc5cd4cc7f3;p=thirdparty%2Fapache%2Fhttpd.git 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/trunk@1307308 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/expr.xml b/docs/manual/expr.xml index bdb3e687bd3..8d3165d47b4 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