httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbo...@apache.org
Subject svn commit: r685411 - in /httpd/httpd/trunk/docs/manual/rewrite: rewrite_guide.html.en rewrite_guide.xml
Date Wed, 13 Aug 2008 01:29:04 GMT
Author: rbowen
Date: Tue Aug 12 18:29:03 2008
New Revision: 685411

URL: http://svn.apache.org/viewvc?rev=685411&view=rev
Log:
This adds a more generic "add www. to all hostnames" ruleset.
It also makes the existing rulesets in this section work both in the
main configuration file and in .htaccess files, by making the leading
slash optional - ie ^/?

Modified:
    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/rewrite_guide.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en?rev=685411&r1=685410&r2=685411&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en Tue Aug 12 18:29:03 2008
@@ -120,15 +120,31 @@
 RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
 RewriteCond %{HTTP_HOST}   !^$
 RewriteCond %{SERVER_PORT} !^80$
-RewriteRule ^/(.*)         http://www.example.com:%{SERVER_PORT}/$1 [L,R]
+RewriteRule ^/?(.*)         http://www.example.com:%{SERVER_PORT}/$1 [L,R]
 </pre></div>
 
 <p>And for a site running on port 80</p>
 <div class="example"><pre>
 RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
 RewriteCond %{HTTP_HOST}   !^$
-RewriteRule ^/(.*)         http://www.example.com/$1 [L,R]
+RewriteRule ^/?(.*)         http://www.example.com/$1 [L,R]
 </pre></div>
+
+        <p>
+        If you wanted to do this generically for all domain names - that
+        is, if you want to redirect <strong>example.com</strong> to
+        <strong>www.example.com</strong> for all possible values of
+        <strong>example.com</strong>, you could use the following
+        recipe:</p>
+
+<div class="example"><pre>
+RewriteCond %{HTTP_HOST} !^www\. [NC]
+RewriteCond %{HTTP_HOST} !^$
+RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R]
+</pre></div>
+
+    <p>These rulesets will work either in your main server configuration
+    file, or in a <code>.htaccess</code> file placed in the <code class="directive"><a
href="../mod/core.html#documentroot">DocumentRoot</a></code> of the server.</p>
         </dd>
       </dl>
 

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=685411&r1=685410&r2=685411&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml Tue Aug 12 18:29:03 2008
@@ -109,15 +109,32 @@
 RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
 RewriteCond %{HTTP_HOST}   !^$
 RewriteCond %{SERVER_PORT} !^80$
-RewriteRule ^/(.*)         http://www.example.com:%{SERVER_PORT}/$1 [L,R]
+RewriteRule ^/?(.*)         http://www.example.com:%{SERVER_PORT}/$1 [L,R]
 </pre></example>
 
 <p>And for a site running on port 80</p>
 <example><pre>
 RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
 RewriteCond %{HTTP_HOST}   !^$
-RewriteRule ^/(.*)         http://www.example.com/$1 [L,R]
+RewriteRule ^/?(.*)         http://www.example.com/$1 [L,R]
 </pre></example>
+
+        <p>
+        If you wanted to do this generically for all domain names - that
+        is, if you want to redirect <strong>example.com</strong> to
+        <strong>www.example.com</strong> for all possible values of
+        <strong>example.com</strong>, you could use the following
+        recipe:</p>
+
+<example><pre>
+RewriteCond %{HTTP_HOST} !^www\. [NC]
+RewriteCond %{HTTP_HOST} !^$
+RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R]
+</pre></example>
+
+    <p>These rulesets will work either in your main server configuration
+    file, or in a <code>.htaccess</code> file placed in the <directive
+    module="core">DocumentRoot</directive> of the server.</p>
         </dd>
       </dl>
 



Mime
View raw message