I ‘ve this little doubt but I couldn’t find information about it, probably because I’m not searching the correct thing.
When a browser ask for “www.mydomain.com”, the DNS server returns an IP Address, then the browser go there… but what does happen then? I mean, that IP address could be a shared hosting that contains hundreds of web pages and domains, so how does it knows where it have to go?
Is something that the web server does? is it something that I could implement in a web application?
I mean, for example I have a web application that contains accounts, and each account has a default web page. You could access that page passing the account namne, for example “www.mydomain.com/myaccount”, but now I want to register “www.myaccount.com” and then it will get the “www.mydomain.com/myaccount” content. Is it possible?
Kind regards.
HTTP/1.1 requires that all requests include a Host header which includes the domain name that you typed in. So a basic request for “http://www.example.com/foo/bar.html” will look like this:
And the web server will then be able to use the Host header to route the request to the correct website, even if there’s more than one on the same IP address.