From: Rich Bowen tags in
tags in
To simply map a URL to another server, we use the [P] flag, as follows:
--RewriteEngine on -RewriteBase /products/ -RewriteRule ^widget/(.*)$ http://product.example.com/widget/$1 [P] ++RewriteEngine on
+RewriteBase /products/
+RewriteRule ^widget/(.*)$ http://product.example.com/widget/$1 [P]
ProxyPassReverse /products/widget/ http://product.example.com/widget/ -
In the second example, we proxy the request only if we can't find the resource locally. This can be very useful when you're migrating from one server to another, and you're not sure if all the content has been migrated yet.
--RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^/(.*) http://old.example.com$1 [P] ++RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^/(.*) http://old.example.com$1 [P]
ProxyPassReverse / http://old.example.com/ -
+diff --git a/docs/manual/rewrite/rewritemap.xml b/docs/manual/rewrite/rewritemap.xml index d8bd1a8bdcd..ff26edee6df 100644 --- a/docs/manual/rewrite/rewritemap.xml +++ b/docs/manual/rewrite/rewritemap.xml @@ -155,17 +155,15 @@ may be used, and give examples of each. the following: With Redirect Redirect /docs/ http://new.example.com/docs/Product to ID map --## -## productmap.txt - Product to ID map file -## - -television 993 -stereo 198 -fishingrod 043 -basketball 418 +##
+## productmap.txt - Product to ID map file
+##
+
+television 993
+stereo 198
+fishingrod 043
+basketball 418
telephone 328 -Thus, when
http://example.com/product/television
is @@ -208,14 +206,12 @@ telephone 328 else is sent to one of the 'dynamic' pool.Rewrite map file --## -## map.txt -- rewriting map -## - -static www1|www2|www3|www4 +##
+## map.txt -- rewriting map
+##
+
+static www1|www2|www3|www4
dynamic www5|www6 -Configuration directives