From: Rich Bowen Date: Sun, 6 Jun 2010 23:03:24 +0000 (+0000) Subject: Alternatives to [P]. X-Git-Tag: 2.3.6~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9cdcd0af5c13e2bfc4219824ce72e1d99d3e7f4d;p=apache Alternatives to [P]. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952019 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/avoid.html.en b/docs/manual/rewrite/avoid.html.en index 1466e6773a..e7bda2a0b2 100644 --- a/docs/manual/rewrite/avoid.html.en +++ b/docs/manual/rewrite/avoid.html.en @@ -38,7 +38,13 @@ particular server configuration, so it's important that you understand them, rather than merely cutting and pasting the examples into your configuration.

-
This document is a work in progress.
+

The most common situation in which mod_rewrite is +the right tool is when the very best solution requires access to the +server configuration files, and you don't have that access. Some +configuration directives are only available in the server configuration +file. So if you are in a hosting situation where you only have .htaccess +files to work with, you may need to resort to +mod_rewrite.

top
diff --git a/docs/manual/rewrite/avoid.xml b/docs/manual/rewrite/avoid.xml index 954f1ef136..9e438b8a16 100644 --- a/docs/manual/rewrite/avoid.xml +++ b/docs/manual/rewrite/avoid.xml @@ -43,7 +43,13 @@ particular server configuration, so it's important that you understand them, rather than merely cutting and pasting the examples into your configuration.

-This document is a work in progress. +

The most common situation in which mod_rewrite is +the right tool is when the very best solution requires access to the +server configuration files, and you don't have that access. Some +configuration directives are only available in the server configuration +file. So if you are in a hosting situation where you only have .htaccess +files to work with, you may need to resort to +mod_rewrite.

Module documentation @@ -167,8 +173,36 @@ seems like the right approach.

RewriteRule provides the [P] flag to pass rewritten URIs through -mod_proxy. As with any use of mod_rewrite, -you want to ask yourself whether it's really the best solution.

+mod_proxy.

+ + +RewriteRule ^/?images(.*) http://imageserver.local/images$1 [P] + + +

However, in many cases, when there is no actual pattern matching +meeded, as in the example shown above, the ProxyPass directive is a better choice. +The example here could be rendered as:

+ + +ProxyPass /images/ http://imageserver.local/images/ + + +

Note that whether you use RewriteRule or ProxyPass, you'll still need to use the +ProxyPassReverse directive to +catch redirects issued from the back-end server:

+ + +ProxyPassReverse /images/ http://imageserver.local/images/ + + +

You may need to use RewriteRule instead when there are +other RewriteRules in effect in the same scope, as a +RewriteRule will usually take effect before a +ProxyPass, and so may preempt what you're trying to +accomplish.