From: Rich Bowen
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
.
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 RewriteRule
s 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.
The most common situation in which
RewriteRule
provides the [P] flag to pass rewritten URIs through
-mod_rewrite
,
-you want to ask yourself whether it's really the best solution.
However, in many cases, when there is no actual pattern matching
+meeded, as in the example shown above, the
Note that whether you use
You may need to use RewriteRule
instead when there are
+other RewriteRule
s 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.