4

Why is it that when I run the command host examplewebsite.com it gives me website's ip, but for some websites, when I type that IP address into the address bar and hit enter, it shows me a 404 page?

Shouldn't it take me to the website I got ip from?

1 Answer 1

8

The difference is in how DNS and the HTTP "Host" header work.

The site you're going to may have multiple sites hosted using the same server. In DNS, all the names for the sites hosted on that IP list the single server IP address. When you enter the name in the browser, the browser sends the hostname to the server using the "Host" header. If you enter only the IP, since it can't know what site you want to go to. Mapping the IP to a name ("reverse DNS") is separate from mapping the name to an IP.

2
  • 2
    All that you say here is correct, but reverse DNS doesn't really come in to it. The answer would be clearer without the last sentence.
    – Isvara
    Nov 28, 2012 at 3:36
  • I see what you mean. I added that because the question implied the user expected a 1 to 1 direct mapping between hosts and IPs in both directions. I'd stated that there wasn't such for forward but not for reverse. Nov 28, 2012 at 3:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .