Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by slive: http://wiki.apache.org/httpd/Recipes/CanonicalHostNames The comment on the change is: The old example would not canonicalize non-listed hostnames. ------------------------------------------------------------------------------ NameVirtualHost *:80 <VirtualHost *:80> + # The first-listed <VirtualHost> is the default host that catches all the + # names specified in its ServerName/ServerAlias, plus all the names + # that are not listed in any other <VirtualHost>, and redirects + # them to the canonical <VirtualHost> below. + ServerName www.example.net + ServerAlias example.com + Redirect permanent / http://www.example.com/ + </VirtualHost> + + <VirtualHost *:80> # Canonical host ServerName www.example.com DocumentRoot /usr/local/apache/htdocs </VirtualHost> - <VirtualHost *:80> - # Non-canonical names for the above vhost - ServerName www.example.net - ServerAlias example.com - Redirect permanent / http://www.example.com/ - </VirtualHost> }}} == Using mod_rewrite ==
