Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am testing a website and have been asked to map a host name (the live website url) to an ip address in my hosts file. My understanding is that this means when I browse to the host name, instead of seeing the live site, I am redirected to the ip address it is mapped to (the test site). This all works fine and I see the test site, what I don't understand is why I see another different test site if i browse directly to the ip address? And if I have two host names mapped to the same url in my hosts file I can see a different site when I browse to each of the host names? How is this possible?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Web-servers use something called vhosts. The server separates sites on the hostname, this allows multiple websites to be hosted on a single IP.

hostname1.domain.com -> IP -> serve files from location: /disk/webserver/website1 hostname2.domain.com -> SAMEIP -> serve files from location: /disk/webserver/website2

You can also setup the webserver to direct to a website when you have no hostname, when you access it directly onits IP.

http:// IP -> /disk/webserver/website3

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.