How do shared hosts, domain names, and DNS work together?

I have little doubt, but I could not find information about this, probably because I was not looking for the right thing.

When the browser asks for β€œwww.mydomain.com”, the DNS server returns the IP address, then the browser goes there ... but then what happens? I mean, an IP address can be shared hosting that contains hundreds of web pages and domains, so how does it know where it should go?

Something that the web server does? Is this something 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 can access this page by transferring a namne account, such as "www.mydomain.com/myaccount", but now I want to register "www.myaccount.com" and then it will get "www.mydomain.com/myaccount" , content. Is it possible?

Sincerely.

+6
dns hosting shared-hosting
source share
2 answers

HTTP / 1.1 requires that all requests include a Host header, which includes the domain name that you entered. Thus, the basic query for " http://www.example.com/foo/bar.html " would look like this:

GET / foo / bar.html HTTP / 1.1
Host: www.example.com

And then the web server will be able to use the Host header to route the request to the correct website, even if it contains more than one on the same IP address.

+11
source share

The web server is processing an application that responds to your request. Your shared hosting has a different name. It is called "virtual hosts." The web server has a list of "virtual hosts", and depending on how you got to the host (through which host name), the web server chooses which application responds to your request.

+2
source share

All Articles