From 7e11840a75a3991b1b40e0985a7ce1eacb5e4f89 Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Thu, 28 Oct 2010 17:31:59 +0000 Subject: [PATCH] Introduce as an alternative to mod_rewrite in the "avoiding mod_rewrite" document. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1028397 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/rewrite/avoid.html.en | 23 ++++++++++++++++++++--- docs/manual/rewrite/avoid.xml | 24 +++++++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/manual/rewrite/avoid.html.en b/docs/manual/rewrite/avoid.html.en index e7bda2a0b2..8916ba4ec6 100644 --- a/docs/manual/rewrite/avoid.html.en +++ b/docs/manual/rewrite/avoid.html.en @@ -194,11 +194,28 @@ accomplish.

Environment Variable Testing

-
Parts of this section are applicable only to Apache HTTP -Server 2.3 and later.
-

Using SetEnvIf and <If> (2.3 and later.)

+

mod_rewrite is frequently used to take a particular +action based on the presence or absense of a particular environment +variable or request header. This can be done more efficiently using the +<If>.

+ +

Consider, for example, the common scenario where +RewriteRule is used to enforce a canonical +hostname, such as www.example.com instead of +example.com. This can be done using the <If> direct, as shown here:

+ +

+<If "$req{Host} = 'example.com'">
+RedirectMatch (.*) http://www.example.com$1 +</If> +

+ +

This technique can be used to take actions based on any request +header, response header, or environment variable, replacing +mod_rewrite in many common scenarios.

+

Available Languages:  en 

diff --git a/docs/manual/rewrite/avoid.xml b/docs/manual/rewrite/avoid.xml index 9e438b8a16..f7b4e9dd0e 100644 --- a/docs/manual/rewrite/avoid.xml +++ b/docs/manual/rewrite/avoid.xml @@ -208,11 +208,29 @@ accomplish.

Environment Variable Testing -Parts of this section are applicable only to Apache HTTP -Server 2.3 and later. -

Using SetEnvIf and <If> (2.3 and later.)

+

mod_rewrite is frequently used to take a particular +action based on the presence or absense of a particular environment +variable or request header. This can be done more efficiently using the +If.

+ +

Consider, for example, the common scenario where +RewriteRule is used to enforce a canonical +hostname, such as www.example.com instead of +example.com. This can be done using the If direct, as shown here:

+ + +<If "$req{Host} = 'example.com'">
+RedirectMatch (.*) http://www.example.com$1 +</If> +
+ +

This technique can be used to take actions based on any request +header, response header, or environment variable, replacing +mod_rewrite in many common scenarios.

+
-- 2.50.1