You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2009/11/05 01:12:41 UTC
svn commit: r832923 - in /httpd/httpd/trunk/docs/manual/rewrite:
remapping.html.en remapping.xml rewrite_guide.html.en rewrite_guide.xml
Author: rbowen
Date: Thu Nov 5 00:12:41 2009
New Revision: 832923
URL: http://svn.apache.org/viewvc?rev=832923&view=rev
Log:
Relocates another recipe, and updates it.
Modified:
httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en
httpd/httpd/trunk/docs/manual/rewrite/remapping.xml
httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en
httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml
Modified: httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en?rev=832923&r1=832922&r2=832923&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en Thu Nov 5 00:12:41 2009
@@ -36,6 +36,7 @@
</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>
@@ -119,6 +120,43 @@
</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 @@
# backward compatibility ruleset for
# rewriting document.html to document.php
# when and only when document.php exists
+<Directory /var/www/htdocs>
RewriteEngine on
+RewriteBase /var/www/htdocs
RewriteCond $1.php -f
RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php
+RewriteRule ^(.*).html$ $1.php
+</Directory>
</pre></div>
</dd>
@@ -196,6 +237,7 @@
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
<Directory> block or in a .htaccess file), so that the
<code>-f</code> checks are looking at the correct directory path.
Modified: httpd/httpd/trunk/docs/manual/rewrite/remapping.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/remapping.xml?rev=832923&r1=832922&r2=832923&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/remapping.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/remapping.xml Thu Nov 5 00:12:41 2009
@@ -118,6 +118,45 @@
</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 @@
# backward compatibility ruleset for
# rewriting document.html to document.php
# when and only when document.php exists
+<Directory /var/www/htdocs>
RewriteEngine on
+RewriteBase /var/www/htdocs
RewriteCond $1.php -f
RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php
+RewriteRule ^(.*).html$ $1.php
+</Directory>
</pre></example>
</dd>
@@ -195,6 +237,7 @@
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
<Directory> block or in a .htaccess file), so that the
<code>-f</code> checks are looking at the correct directory path.
Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en?rev=832923&r1=832922&r2=832923&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en Thu Nov 5 00:12:41 2009
@@ -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 @@
</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>
Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml?rev=832923&r1=832922&r2=832923&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml Thu Nov 5 00:12:41 2009
@@ -191,38 +191,6 @@
</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>