Each web server will generally be accessible by only a single IP address, so before virtual hosts, you’d need an IP per website, which, if you were hosting a few different sites from a single point would start to get expensive, as you’d need to pay for additional addresses.
So virtual hosts were designed, meaning you could host multiple sites on a single IP address. Prior to virtual hosts, your browser would connect to the server and ask for the appropriate page, and there’d only be a single site there meaning you’d get the page you expected.
With the advent of virtual hosts, your browser now needs to connect to the server, and tell the server which website it wants to get a page from, and then which page it wants.
The web server will generally be set up with a default website so if for some reason the browser doesn’t specify a hostname, it will serve the appropriately requested page from the default setup.
Latest Answers