named host for both www.foo.com and foo.com

This is a discussion on named host for both www.foo.com and foo.com within the Linux Web Servers forums, part of the Web Server and Related Forums category; apache 1.3.x , if i'm using named virtual hosts and i want my server to respond to both ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-26-2003
peter dobbs
 
Posts: n/a
Default named host for both www.foo.com and foo.com

apache 1.3.x ,
if i'm using named virtual hosts and i want my server to respond to
both www.foo.com and foo.com, what is the best method ?

should i have 2 named hosts pointing to the same documentRoot, and if
so is it ok to have them both write to the same access_log ?

or should I have one re-direct all traffic to the other?

Seems there might be a 3rd option or maybe i'm missing something.
  #2 (permalink)  
Old 06-26-2003
Andreas Paasch
 
Posts: n/a
Default Re: named host for both www.foo.com and foo.com

peter dobbs wrote:

> apache 1.3.x ,
> if i'm using named virtual hosts and i want my server to respond to
> both www.foo.com and foo.com, what is the best method ?
>
> should i have 2 named hosts pointing to the same documentRoot, and if
> so is it ok to have them both write to the same access_log ?
>
> or should I have one re-direct all traffic to the other?
>
> Seems there might be a 3rd option or maybe i'm missing something.


As your domain name points to a specific IP address and this AFAIK not
depends on www, then both www.foo.com and foo.com will be requested once a
request for either one is made in some browser.

Example: foo.com is registered with IP: 123.456.789.012
A request for http://foo.com will end up in the above IP.
A request for http://www.foo.com will end the same place.

For you, setup the default server to ServerName www.foo.com.
There is no need for you to do further, i.e. setup foo.com as VirtualHost,
as all request if not specified by a seperat VirtualHost will be answered
by the default server, in this case www.foo.com.

All along, I assume that www.foo.com and foo.com will contain the same.
Should you have different content on those two domains, then you should set
up a VirtualHost for foo.com

HTH,

/Andreas



--
Registeret Linux user #292411
  #3 (permalink)  
Old 06-26-2003
Joachim Ring
 
Posts: n/a
Default Re: named host for both www.foo.com and foo.com

> apache 1.3.x ,
> if i'm using named virtual hosts and i want my server to respond to
> both www.foo.com and foo.com, what is the best method ?


one vhost, ServerName foo.com, ServerAlias www.foo.com

> should i have 2 named hosts pointing to the same documentRoot, and if
> so is it ok to have them both write to the same access_log ?


it would be, but why?

> or should I have one re-direct all traffic to the other?


that's another option and the way to go if site layout was done by
moronic designers with random absolute links...

joachim
  #4 (permalink)  
Old 06-27-2003
David Efflandt
 
Posts: n/a
Default Re: named host for both www.foo.com and foo.com

On Thu, 26 Jun 2003 23:02:39 +0200, Andreas Paasch <Andreas@Paasch.Net> wrote:
> peter dobbs wrote:
>
>> apache 1.3.x ,
>> if i'm using named virtual hosts and i want my server to respond to
>> both www.foo.com and foo.com, what is the best method ?
>>
>> should i have 2 named hosts pointing to the same documentRoot, and if
>> so is it ok to have them both write to the same access_log ?
>>
>> or should I have one re-direct all traffic to the other?
>>
>> Seems there might be a 3rd option or maybe i'm missing something.

>
> As your domain name points to a specific IP address and this AFAIK not
> depends on www, then both www.foo.com and foo.com will be requested once a
> request for either one is made in some browser.
>
> Example: foo.com is registered with IP: 123.456.789.012
> A request for http://foo.com will end up in the above IP.
> A request for http://www.foo.com will end the same place.
>
> For you, setup the default server to ServerName www.foo.com.
> There is no need for you to do further, i.e. setup foo.com as VirtualHost,
> as all request if not specified by a seperat VirtualHost will be answered
> by the default server, in this case www.foo.com.


Not quite. NameVirtualHost implies using more than 1 virtual host,
usually with different contant. So he may also have http://www.bar.com/
and http://bar.com/ pointing elsewhere.

But ServerName and ServerAlias within each vhost should do it. Assuming
UseCanonicalName off, the following in a vhost would be a catchall that
would include www.foo.com:

ServerName foo.com
ServerAlias *.foo.com

--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:44 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0