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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
> 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 |
|
|||
|
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 | |
| Display Modes | |
|
|