diff options
author | Rich Bowen <rbowen@apache.org> | 2010-10-28 17:31:59 +0000 |
---|---|---|
committer | Rich Bowen <rbowen@apache.org> | 2010-10-28 17:31:59 +0000 |
commit | 7e11840a75a3991b1b40e0985a7ce1eacb5e4f89 (patch) | |
tree | f448e7de016a2912b5f3b757947b805ec850bf1c /docs/manual/rewrite | |
parent | 7017e255fc2fb5949a629c7099ad3bd606198aee (diff) | |
download | httpd-7e11840a75a3991b1b40e0985a7ce1eacb5e4f89.tar.gz |
Introduce <If> 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
Diffstat (limited to 'docs/manual/rewrite')
-rw-r--r-- | docs/manual/rewrite/avoid.html.en | 23 | ||||
-rw-r--r-- | 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.</p> <div class="section"> <h2><a name="setenv" id="setenv">Environment Variable Testing</a></h2> -<div class="note">Parts of this section are applicable only to Apache HTTP -Server 2.3 and later.</div> - <p>Using SetEnvIf and <If> (2.3 and later.)</p> +<p><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> 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 +<code class="directive"><a href="../mod/core.html#if"><If></a></code>.</p> + +<p>Consider, for example, the common scenario where +<code class="directive">RewriteRule</code> is used to enforce a canonical +hostname, such as <code>www.example.com</code> instead of +<code>example.com</code>. This can be done using the <code class="directive"><a href="../mod/core.html#if"><If></a></code> direct, as shown here:</p> + +<div class="example"><p><code> +<If "$req{Host} = 'example.com'"><br /> +RedirectMatch (.*) http://www.example.com$1 +</If> +</code></p></div> + +<p>This technique can be used to take actions based on any request +header, response header, or environment variable, replacing +<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> in many common scenarios.</p> + </div></div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/rewrite/avoid.html" title="English"> en </a></p> 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.</p> <section id="setenv"><title>Environment Variable Testing</title> -<note type="note">Parts of this section are applicable only to Apache HTTP -Server 2.3 and later.</note> - <p>Using SetEnvIf and <If> (2.3 and later.)</p> +<p><module>mod_rewrite</module> 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 +<directive module="core" type="section">If</directive>.</p> + +<p>Consider, for example, the common scenario where +<directive>RewriteRule</directive> is used to enforce a canonical +hostname, such as <code>www.example.com</code> instead of +<code>example.com</code>. This can be done using the <directive +module="core" type="section">If</directive> direct, as shown here:</p> + +<example> +<If "$req{Host} = 'example.com'"><br /> +RedirectMatch (.*) http://www.example.com$1 +</If> +</example> + +<p>This technique can be used to take actions based on any request +header, response header, or environment variable, replacing +<module>mod_rewrite</module> in many common scenarios.</p> + </section> </manualpage> |