]> granicus.if.org Git - apache/commitdiff
Relocates another recipe, and updates it.
authorRich Bowen <rbowen@apache.org>
Thu, 5 Nov 2009 00:12:41 +0000 (00:12 +0000)
committerRich Bowen <rbowen@apache.org>
Thu, 5 Nov 2009 00:12:41 +0000 (00:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832923 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/rewrite/remapping.html.en
docs/manual/rewrite/remapping.xml
docs/manual/rewrite/rewrite_guide.html.en
docs/manual/rewrite/rewrite_guide.xml

index 70a74aad545dd38b0d660f2b725bd7522c477f7a..598c4583c64b9c705bc9c3eeb2528c122246ef82 100644 (file)
@@ -36,6 +36,7 @@ configuration.</div>
 </div>
 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#old-to-new">From Old to New (internal)</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#old-to-new-extern">Rewriting From Old to New (external)</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#movehomedirs">Resource Moved to Another Server</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#static-to-dynamic">From Static to Dynamic</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#backward-compatibility">Backward Compatibility for file extension change</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#canonicalhost">Canonical Hostnames</a></li>
@@ -117,6 +118,43 @@ RewriteRule    ^<strong>/foo</strong>\.html$  <strong>bar</strong>.html  [<stron
     </dd>
   </dl>
 
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="movehomedirs" id="movehomedirs">Resource Moved to Another Server</a></h2>
+
+  
+
+  <dl>
+    <dt>Description:</dt>
+
+    <dd>
+      <p>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.</p>
+    </dd>
+
+    <dt>Solution:</dt>
+
+    <dd>
+      <p>You can use <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> to redirect these URLs
+      to the new server, but you might also consider using the Redirect
+      or RedirectMatch directive.</p>
+
+<div class="example"><h3>With mod_rewrite</h3><pre>
+RewriteEngine on
+RewriteRule   ^/docs/(.+)  http://new.example.com/docs/$1  [R,L]
+</pre></div>
+
+<div class="example"><h3>With RedirectMatch</h3><pre>
+RedirectMatch ^/docs/(.*) http://new.example.com/docs/$1
+</pre></div>
+
+<div class="example"><h3>With Redirect</h3><pre>
+Redirect /docs/ http://new.example.com/docs/
+</pre></div>
+    </dd>
+  </dl>
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="static-to-dynamic" id="static-to-dynamic">From Static to Dynamic</a></h2>
@@ -178,11 +216,14 @@ RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [H=<stron
 #   backward compatibility ruleset for
 #   rewriting document.html to document.php
 #   when and only when document.php exists
+&lt;Directory /var/www/htdocs&gt;
 RewriteEngine on
+RewriteBase /var/www/htdocs
 
 RewriteCond $1.php -f
 RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php 
+RewriteRule ^(.*).html$ $1.php
+&lt;/Directory&gt;
 </pre></div>
     </dd>
 
@@ -196,6 +237,7 @@ RewriteRule ^(.*).html$ $1.php
     directives are evaluated. This allows us to test for the existence
     of the the original (<code>document.html</code>) and target
     (<code>document.php</code>) files using the same base filename.</p>
+
     <p>This ruleset is designed to use in a per-directory context (In a
     &lt;Directory&gt; block or in a .htaccess file), so that the
     <code>-f</code> checks are looking at the correct directory path.
index 8850219280cca86385c8100375127f14167909d6..b71cad19493b17e92c2c333dd71c13febacb2688 100644 (file)
@@ -118,6 +118,45 @@ RewriteRule    ^<strong>/foo</strong>\.html$  <strong>bar</strong>.html  [<stron
 
 </section>
 
+<section id="movehomedirs">
+
+  <title>Resource Moved to Another Server</title>
+
+  <dl>
+    <dt>Description:</dt>
+
+    <dd>
+      <p>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.</p>
+    </dd>
+
+    <dt>Solution:</dt>
+
+    <dd>
+      <p>You can use <module>mod_rewrite</module> to redirect these URLs
+      to the new server, but you might also consider using the Redirect
+      or RedirectMatch directive.</p>
+
+<example><title>With mod_rewrite</title><pre>
+RewriteEngine on
+RewriteRule   ^/docs/(.+)  http://new.example.com/docs/$1  [R,L]
+</pre></example>
+
+<example><title>With RedirectMatch</title><pre>
+RedirectMatch ^/docs/(.*) http://new.example.com/docs/$1
+</pre></example>
+
+<example><title>With Redirect</title><pre>
+Redirect /docs/ http://new.example.com/docs/
+</pre></example>
+    </dd>
+  </dl>
+
+</section>
+
+
+
 <section id="static-to-dynamic">
 
   <title>From Static to Dynamic</title>
@@ -177,11 +216,14 @@ RewriteRule    ^foo\.<strong>html</strong>$  foo.<strong>cgi</strong>  [H=<stron
 #   backward compatibility ruleset for
 #   rewriting document.html to document.php
 #   when and only when document.php exists
+&lt;Directory /var/www/htdocs&gt;
 RewriteEngine on
+RewriteBase /var/www/htdocs
 
 RewriteCond $1.php -f
 RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php 
+RewriteRule ^(.*).html$ $1.php
+&lt;/Directory&gt;
 </pre></example>
     </dd>
 
@@ -195,6 +237,7 @@ RewriteRule ^(.*).html$ $1.php
     directives are evaluated. This allows us to test for the existence
     of the the original (<code>document.html</code>) and target
     (<code>document.php</code>) files using the same base filename.</p>
+
     <p>This ruleset is designed to use in a per-directory context (In a
     &lt;Directory&gt; block or in a .htaccess file), so that the
     <code>-f</code> checks are looking at the correct directory path.
index bafa180a025731ff86e02f138179f1a51a96798e..010c78e26dc09e68bd4c77404dea67ac747e0ac1 100644 (file)
@@ -44,7 +44,6 @@
 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#canonicalurl">Canonical URLs</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#moveddocroot">Moved <code>DocumentRoot</code></a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#trailingslash">Trailing Slash Problem</a></li>
-<li><img alt="" src="../images/down.gif" /> <a href="#movehomedirs">Move Homedirs to Different Webserver</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#setenvvars">Set Environment Variables According To URL Parts</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#uservhosts">Virtual Hosts Per User</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#redirecthome">Redirect Homedirs For Foreigners</a></li>
@@ -207,38 +206,6 @@ RewriteRule    ^(.+<strong>[^/]</strong>)$           $1<strong>/</strong>  [R]
 
     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="movehomedirs" id="movehomedirs">Move Homedirs to Different Webserver</a></h2>
-
-      
-
-      <dl>
-        <dt>Description:</dt>
-
-        <dd>
-          <p>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.</p>
-        </dd>
-
-        <dt>Solution:</dt>
-
-        <dd>
-          <p>The solution is trivial with <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>.
-          On the old webserver we just redirect all
-          <code>/~user/anypath</code> URLs to
-          <code>http://newserver/~user/anypath</code>.</p>
-
-<div class="example"><pre>
-RewriteEngine on
-RewriteRule   ^/~(.+)  http://<strong>newserver</strong>/~$1  [R,L]
-</pre></div>
-        </dd>
-      </dl>
-
-    </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
-<div class="section">
 <h2><a name="setenvvars" id="setenvvars">Set Environment Variables According To URL Parts</a></h2>
 
       
index b3b2166b4b7ad2a870628b0d224c668fd15e5ba9..106ca72c325d3f885162ed884532fda438e3c3f7 100644 (file)
@@ -191,38 +191,6 @@ RewriteRule    ^(.+<strong>[^/]</strong>)$           $1<strong>/</strong>  [R]
 
     </section>
 
-    <section id="movehomedirs">
-
-      <title>Move Homedirs to Different Webserver</title>
-
-      <dl>
-        <dt>Description:</dt>
-
-        <dd>
-          <p>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.</p>
-        </dd>
-
-        <dt>Solution:</dt>
-
-        <dd>
-          <p>The solution is trivial with <module>mod_rewrite</module>.
-          On the old webserver we just redirect all
-          <code>/~user/anypath</code> URLs to
-          <code>http://newserver/~user/anypath</code>.</p>
-
-<example><pre>
-RewriteEngine on
-RewriteRule   ^/~(.+)  http://<strong>newserver</strong>/~$1  [R,L]
-</pre></example>
-        </dd>
-      </dl>
-
-    </section>
-
     <section id="setenvvars">
 
       <title>Set Environment Variables According To URL Parts</title>