From: Rich Bowen Date: Fri, 7 Dec 2007 18:26:09 +0000 (+0000) Subject: Provide a recipe description, (from the 2.0 docs) and make the recipe match the X-Git-Tag: 2.2.7~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0651116da81805454e3b580e2a4be212e916b192;p=thirdparty%2Fapache%2Fhttpd.git Provide a recipe description, (from the 2.0 docs) and make the recipe match the description. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@602173 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/misc/rewriteguide.xml b/docs/manual/misc/rewriteguide.xml index 8a0d22cc717..a959eb3b87c 100644 --- a/docs/manual/misc/rewriteguide.xml +++ b/docs/manual/misc/rewriteguide.xml @@ -131,19 +131,23 @@ RewriteRule ^/([uge])/([^/]+)$ /$1/$2/ [<
Description:
-
...
+
The goal of this rule is to force the use of a particular + hostname, in preference to other hostnames which may be used to + reach the same site. For example, if you wish to force the use + of www.example.com instead of + example.com, you might use a variant of the + following recipe.
+
Solution:
-RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
-RewriteCond %{HTTP_HOST}   !^$
-RewriteCond %{SERVER_PORT} !^80$
-RewriteRule ^/(.*)         http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R]
-RewriteCond %{HTTP_HOST}   !^fully\.qualified\.domain\.name [NC]
+# To force the use of 
+RewriteEngine On
+RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
 RewriteCond %{HTTP_HOST}   !^$
-RewriteRule ^/(.*)         http://fully.qualified.domain.name/$1 [L,R]
+RewriteRule ^/(.*)         http://www.example.com/$1 [L,R]