Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

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.

share|improve this answer
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. –  Derecho Nov 28 '12 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. –  Steve Wills Nov 28 '12 at 3:39
add comment

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.