
rbowen at apache
Nov 5, 2009, 7:43 AM
Post #1 of 1
(55 views)
Permalink
|
|
svn commit: r833061 - 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 15:43:23 2009 New Revision: 833061 URL: http://svn.apache.org/viewvc?rev=833061&view=rev Log: Moves the "canonial URL" example to remapping 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=833061&r1=833060&r2=833061&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en (original) +++ httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en Thu Nov 5 15:43:23 2009 @@ -43,6 +43,7 @@ <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 @@ </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"> en </a></p> </div><div id="footer"> Modified: httpd/httpd/trunk/docs/manual/rewrite/remapping.xml URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/remapping.xml?rev=833061&r1=833060&r2=833061&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/remapping.xml (original) +++ httpd/httpd/trunk/docs/manual/rewrite/remapping.xml Thu Nov 5 15:43:23 2009 @@ -440,4 +440,49 @@ </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> 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=833061&r1=833060&r2=833061&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 15:43:23 2009 @@ -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 @@ 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> 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=833061&r1=833060&r2=833061&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml (original) +++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml Thu Nov 5 15:43:23 2009 @@ -54,41 +54,6 @@ <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>
|