i.e I want to direct a user to the same content whether they enter
mysite.com or www.mysite.com
I'm using name-based virtual hosting and any help would be
appreciated.
Regards
Chris
> I'm using name-based virtual hosting and any help would be
> appreciated.
I'm using a rewrite in the _default_ virtual host:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www)\.
RewriteCond %{HTTP_HOST} ^([^\.]+\.)?([^\.]+\.[^\.]+)$
RewriteRule (.*) http://www.%2$1?d=1 [R=301,QSA,L]
The 'd=1' is only a reference logged with the redirected request by the
proper vhost.
( 'Using another Rewrite at the same vhost to take care of spelling errors
... like www.misite.com or www.myside.com and adds 'd=2' as marker )
For the default vhost you may want to append the host name to the log
LogFormat "%h %l %u ....... \"%{host}i\"" combined-host
HansH