]> granicus.if.org Git - apache/commitdiff
Moves the "canonial URL" example to remapping
authorRich Bowen <rbowen@apache.org>
Thu, 5 Nov 2009 15:43:23 +0000 (15:43 +0000)
committerRich Bowen <rbowen@apache.org>
Thu, 5 Nov 2009 15:43:23 +0000 (15:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@833061 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 df8eb72e94baa8343f456bbe1aff2cbe75da22e8..bbb78fdb41cc0a44419308b6b29d8ffed71e5c94 100644 (file)
@@ -43,6 +43,7 @@ configuration.</div>
 <li><img alt="" src="../images/down.gif" /> <a href="#multipledirs">Search for pages in more than one directory</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#archive-access-multiplexer">Redirecting to Geographically Distributed Servers</a></li>
 <li><img alt="" src="../images/down.gif" /> <a href="#browser-dependent-content">Browser Dependent Content</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#canonicalurl">Canonical URLs</a></li>
 </ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
@@ -437,7 +438,50 @@ RewriteRule ^foo\.html$         foo.<strong>32</strong>.html          [<strong>L
     </dd>
   </dl>
 
-</div></div>
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="canonicalurl" id="canonicalurl">Canonical URLs</a></h2>
+
+
+
+<dl>
+ <dt>Description:</dt>
+
+   <dd>
+     <p>On some webservers there is more than one URL for a
+     resource. Usually there are canonical URLs (which are be
+     actually used and distributed) and those which are just
+     shortcuts, internal ones, and so on. Independent of which URL the
+     user supplied with the request, they should finally see the
+     canonical one in their browser address bar.</p>
+   </dd>
+
+   <dt>Solution:</dt>
+
+     <dd>
+       <p>We do an external HTTP redirect for all non-canonical
+       URLs to fix them in the location view of the Browser and
+       for all subsequent requests. In the example ruleset below
+       we replace <code>/puppies</code> and <code>/canines</code>
+       by the canonical <code>/dogs</code>.</p>
+
+<div class="example"><pre>
+RewriteRule   ^/(puppies|canines)/(.*)    /dogs/$2  [R]
+</pre></div>
+        </dd>
+
+     <dt>Discussion:</dt>
+     <dd>
+     This should really be accomplished with Redirect or RedirectMatch
+     directives:
+
+     <div class="example"><pre>
+     RedirectMatch ^/(puppies|canines)/(.*) /dogs/$2
+     </pre></div>
+     </dd>
+      </dl>
+
+    </div></div>
 <div class="bottomlang">
 <p><span>Available Languages: </span><a href="../en/rewrite/remapping.html" title="English">&nbsp;en&nbsp;</a></p>
 </div><div id="footer">
index a35ca38ee9f8a64983922ee61c7c053bb06e92c9..7cea9775f61f29fec82ee73ac738669cb856aeb5 100644 (file)
@@ -440,4 +440,49 @@ RewriteRule ^foo\.html$         foo.<strong>32</strong>.html          [<strong>L
 
 </section>
 
+<section id="canonicalurl">
+
+<title>Canonical URLs</title>
+
+<dl>
+ <dt>Description:</dt>
+
+   <dd>
+     <p>On some webservers there is more than one URL for a
+     resource. Usually there are canonical URLs (which are be
+     actually used and distributed) and those which are just
+     shortcuts, internal ones, and so on. Independent of which URL the
+     user supplied with the request, they should finally see the
+     canonical one in their browser address bar.</p>
+   </dd>
+
+   <dt>Solution:</dt>
+
+     <dd>
+       <p>We do an external HTTP redirect for all non-canonical
+       URLs to fix them in the location view of the Browser and
+       for all subsequent requests. In the example ruleset below
+       we replace <code>/puppies</code> and <code>/canines</code>
+       by the canonical <code>/dogs</code>.</p>
+
+<example><pre>
+RewriteRule   ^/(puppies|canines)/(.*)    /dogs/$2  [R]
+</pre></example>
+        </dd>
+
+     <dt>Discussion:</dt>
+     <dd>
+     This should really be accomplished with Redirect or RedirectMatch
+     directives:
+
+     <example><pre>
+     RedirectMatch ^/(puppies|canines)/(.*) /dogs/$2
+     </pre></example>
+     </dd>
+      </dl>
+
+    </section>
+
+
+
 </manualpage> 
index 4e99250f6decc06c03050759c64591132ad5435e..b30ebca643f4762bf977c3723f3e6c7a6addafb5 100644 (file)
@@ -41,8 +41,7 @@
     avoids many problems.</div>
 
   </div>
-<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>
+<div id="quickview"><ul id="toc"><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="#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>
@@ -65,41 +64,6 @@ introduction</a></li><li><a href="rewrite_guide_advanced.html">Advanced Rewrite
 useful examples</a></li><li><a href="tech.html">Technical details</a></li></ul></div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
-<h2><a name="canonicalurl" id="canonicalurl">Canonical URLs</a></h2>
-
-
-
-<dl>
- <dt>Description:</dt>
-
-   <dd>
-     <p>On some webservers there are more than one URL for a
-     resource. Usually there are canonical URLs (which should be
-     actually used and distributed) and those which are just
-     shortcuts, internal ones, etc. Independent of which URL the
-     user supplied with the request he should finally see the
-     canonical one only.</p>
-   </dd>
-
-   <dt>Solution:</dt>
-
-     <dd>
-       <p>We do an external HTTP redirect for all non-canonical
-       URLs to fix them in the location view of the Browser and
-       for all subsequent requests. In the example ruleset below
-       we replace <code>/~user</code> by the canonical
-       <code>/u/user</code> and fix a missing trailing slash for
-       <code>/u/user</code>.</p>
-
-<div class="example"><pre>
-RewriteRule   ^/<strong>~</strong>([^/]+)/?(.*)    /<strong>u</strong>/$1/$2  [<strong>R</strong>]
-RewriteRule   ^/u/(<strong>[^/]+</strong>)$  /$1/$2<strong>/</strong>   [<strong>R</strong>]
-</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="moveddocroot" id="moveddocroot">Moved <code>DocumentRoot</code></a></h2>
 
       
index df2e137ece54965299af55c7856e7abbeeb47f2f..f6b3578c22f4324485ec3e6ecae4facd3f9d6f55 100644 (file)
@@ -54,41 +54,6 @@ useful examples</a></seealso>
 <seealso><a href="tech.html">Technical details</a></seealso>
 
 
-<section id="canonicalurl">
-
-<title>Canonical URLs</title>
-
-<dl>
- <dt>Description:</dt>
-
-   <dd>
-     <p>On some webservers there are more than one URL for a
-     resource. Usually there are canonical URLs (which should be
-     actually used and distributed) and those which are just
-     shortcuts, internal ones, etc. Independent of which URL the
-     user supplied with the request he should finally see the
-     canonical one only.</p>
-   </dd>
-
-   <dt>Solution:</dt>
-
-     <dd>
-       <p>We do an external HTTP redirect for all non-canonical
-       URLs to fix them in the location view of the Browser and
-       for all subsequent requests. In the example ruleset below
-       we replace <code>/~user</code> by the canonical
-       <code>/u/user</code> and fix a missing trailing slash for
-       <code>/u/user</code>.</p>
-
-<example><pre>
-RewriteRule   ^/<strong>~</strong>([^/]+)/?(.*)    /<strong>u</strong>/$1/$2  [<strong>R</strong>]
-RewriteRule   ^/u/(<strong>[^/]+</strong>)$  /$1/$2<strong>/</strong>   [<strong>R</strong>]
-</pre></example>
-        </dd>
-      </dl>
-
-    </section>
-
     <section id="moveddocroot">
 
       <title>Moved <code>DocumentRoot</code></title>