From: Rich Bowen If a resource has moved to another server, you may wish to have
+ URLs continue to work for a time on the old server while people
+ update their bookmarks. You can use From Old to New (internal)
Rewriting From Old to New (external)
Resource Moved to Another Server
From Static to Dynamic
Backward Compatibility for file extension change
Canonical Hostnames
Resource Moved to Another Server
+
+
+
+
+
+
mod_rewrite
to redirect these URLs
+ to the new server, but you might also consider using the Redirect
+ or RedirectMatch directive.With mod_rewrite
+RewriteEngine on
+RewriteRule ^/docs/(.+) http://new.example.com/docs/$1 [R,L]
+
With RedirectMatch
+RedirectMatch ^/docs/(.*) http://new.example.com/docs/$1
+
With Redirect
+Redirect /docs/ http://new.example.com/docs/
+
From Static to Dynamic
@@ -178,11 +216,14 @@ RewriteRule ^foo\.html$ foo.cgi [H=document.html
) and target
(document.php
) files using the same base filename.
This ruleset is designed to use in a per-directory context (In a
<Directory> block or in a .htaccess file), so that the
If a resource has moved to another server, you may wish to have
+ URLs continue to work for a time on the old server while people
+ update their bookmarks. You can use -f
checks are looking at the correct directory path.
diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml
index 8850219280..b71cad1949 100644
--- a/docs/manual/rewrite/remapping.xml
+++ b/docs/manual/rewrite/remapping.xml
@@ -118,6 +118,45 @@ RewriteRule ^/foo\.html$ bar.html [
+
+
+
+RewriteEngine on
+RewriteRule ^/docs/(.+) http://new.example.com/docs/$1 [R,L]
+
+RedirectMatch ^/docs/(.*) http://new.example.com/docs/$1
+
+Redirect /docs/ http://new.example.com/docs/
+
document.html
) and target
(document.php
) files using the same base filename.
This ruleset is designed to use in a per-directory context (In a
<Directory> block or in a .htaccess file), so that the
-f
checks are looking at the correct directory path.
diff --git a/docs/manual/rewrite/rewrite_guide.html.en b/docs/manual/rewrite/rewrite_guide.html.en
index bafa180a02..010c78e26d 100644
--- a/docs/manual/rewrite/rewrite_guide.html.en
+++ b/docs/manual/rewrite/rewrite_guide.html.en
@@ -44,7 +44,6 @@
DocumentRoot
Many webmasters have asked for a solution to the - following situation: They wanted to redirect just all - homedirs on a webserver to another webserver. They usually - need such things when establishing a newer webserver which - will replace the old one over time.
-The solution is trivial with mod_rewrite
.
- On the old webserver we just redirect all
- /~user/anypath
URLs to
- http://newserver/~user/anypath
.
-RewriteEngine on -RewriteRule ^/~(.+) http://newserver/~$1 [R,L] -
Many webmasters have asked for a solution to the - following situation: They wanted to redirect just all - homedirs on a webserver to another webserver. They usually - need such things when establishing a newer webserver which - will replace the old one over time.
-The solution is trivial with /~user/anypath
URLs to
- http://newserver/~user/anypath
.
-RewriteEngine on -RewriteRule ^/~(.+) http://newserver/~$1 [R,L] -