PDA

View Full Version : How can serveral domain name be differentiated which...


cain a
05-28-2007, 08:02 PM
...being accessed since they belongs to ONE ip address? A http server hosts several domains,for example, www.example1.com, www.example2.com, and www.example3.com. But there is only one IP address. So the three domains correspond to the same IP address.
The problem is, if I enter www.example1.com into my browser address bar and hit "go", first thing, this domain name will be resolved to an IP address, and then my computer just uses this IP address(plus a default TCP port 80) to fetch a web page. I very much know that different domain name will get different page. But how can the three domain name here be differentiated since they corresponds to one IP address?

I am very much confused by this problem and hope some tech-savvy persons can give me a clear explanation. Thank you very much indeed!

reason1000
06-03-2007, 08:46 AM
When you send a request for a website, for example www.fakedomain.com, the name of the domain you are requesting is included in something called a "host header." The server that receives the request looks at this host header and is able to display the site corresponding to that information. This is called Virtual Hosting. The web server software is able to assign multiple domain names to one single IP address. The host header is what allows this to happen.