views:

435

answers:

3

Is there any difference between the following when a intranet URL in accessed in IE

Add an entry in drivers/etc/host file for a name and IP vs Use IP directly

e.g. it works with the following link if I have a host entry as (XYZ 10.0.10.200)

http://XYZ/SiteDirectory/ABC/Default.aspx

but when I tried to use IP instead of name

http://10.0.10.200/SiteDirectory/ABC/Default.aspx

It gives me 404 not found error

A: 

As far as I can see there should be no difference. With a host name the order is hosts file before DNS so it should be used.

Is there another line in the host file with the same hostname?

What happens when you do a tacert? (trace route)

Karl
No, the host file contains only one entry for this IPTraceRt returns: 1 13 ms 1 ms 1 ms 10.0.171.2 2 <1 ms <1 ms <1 ms 10.0.155.9 3 <1 ms <1 ms <1 ms XYZ [10.0.10.200]
usman shaheen
SYes, there is a difference, not in DNS but in HTTP. See Jonatan Magnusson's correct answer.
bortzmeyer
+5  A: 

Smells like the webserver is using virtual hosts, so that it serves different pages if the client went to "www.foo.com" or "www.bar.com", even though they have the same IP-address.

Jonatan
+3  A: 

Yes, there's a difference.

The web server is using HTTP/1.1 and "shared virtual hosting". When the client connects it sends an additional Host: header which contains the hostname part of the URL that the user supplied.

The web server looks at the header to find out which virtual host's data to serve.

In this case, the web server is configured to recognise and serve content from the "XYZ" domain, but doesn't know about any domain called 10.0.10.200

Alnitak