Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 71161 invoked by uid 500); 8 Nov 2001 16:05:01 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 71141 invoked by uid 500); 8 Nov 2001 16:05:01 -0000 Delivered-To: apmail-apache-1.3-cvs@apache.org Delivered-To: apmail-httpd-docs-1.3-cvs@apache.org Date: 8 Nov 2001 15:53:12 -0000 Message-ID: <20011108155312.35474.qmail@icarus.apache.org> From: slive@apache.org To: httpd-docs-1.3-cvs@apache.org Subject: cvs commit: httpd-docs-1.3/htdocs/manual/misc FAQ-E.html X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N slive 01/11/08 07:53:12 Modified: htdocs/manual/misc FAQ-E.html Log: Add a FAQ for "canonical hostnames". This crossed my "three times in a month" threshold on comp.infosystems.www.servers.unix. Revision Changes Path 1.12 +47 -1 httpd-docs-1.3/htdocs/manual/misc/FAQ-E.html Index: FAQ-E.html =================================================================== RCS file: /home/cvs/httpd-docs-1.3/htdocs/manual/misc/FAQ-E.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -b -u -r1.11 -r1.12 --- FAQ-E.html 2001/10/08 01:26:54 1.11 +++ FAQ-E.html 2001/11/08 15:53:11 1.12 @@ -33,7 +33,7 @@

Apache Server Frequently Asked Questions

-

$Revision: 1.11 $ ($Date: 2001/10/08 01:26:54 $)

+

$Revision: 1.12 $ ($Date: 2001/11/08 15:53:11 $)

The latest version of this FAQ is always available from the main Apache web site, at <Why do my files appear correctly in Internet Explorer, but show up as source or trigger a save window with Netscape? + +

  • My site is accessible + under many different hostnames; how do I redirect clients + so that they see only a single name?
  • @@ -649,6 +653,48 @@ directive in the Apache configuration files.


    +
  • + My site is accessible + under many different hostnames; how do I redirect clients + so that they see only a single name?
  • + +

    Many sites map a variety of hostnames to the same content. + (This differs from virtual hosting where + different hostnames map to different content.) For example, + www.example.com, example.com and + www.example.net may all refer to the same site. + It is best to make sure that, regardless of the name clients + use to access the site, they will be redirected to a single, + canonical hostname. This makes the site easier to maintain + and assures that there will be only one version of the site + in proxy caches and search engines.

    + +

    There are two techniques to implement canonical hostnames:

    + +
      +
    1. Use mod_rewrite + as described in the "Canonical Hostnames" section of the + URL Rewriting Guide.
    2. + +
    3. Use name-based + virtual hosting: + +
      +NameVirtualHost *
      +
      +<VirtualHost *>
      +  ServerName www.example.net
      +  ServerAlias example.com
      +  Redirect permanent / http://www.example.com/
      +</VirtualHost>
      +
      +<VirtualHost *>
      +  ServerName www.example.com
      +  DocumentRoot /usr/local/apache/htdocs
      +</VirtualHost> +
      +
    +