在主机文件中指定IP与直接使用IP之间的区别 [英] Difference between specifying IP in host file vs using IP directly
问题描述
在IE中访问Intranet URL时,以下内容之间是否有任何区别
Is there any difference between the following when a intranet URL in accessed in IE
在drivers / etc / host文件中添加名称和IP $ b的条目$ b vs
直接使用IP
Add an entry in drivers/etc/host file for a name and IP vs Use IP directly
例如如果我有一个主机条目(XYZ 10.0.10.200)
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
但当我尝试使用IP代替名称
but when I tried to use IP instead of name
http://10.0 .10.200 / SiteDirectory / ABC / Default.aspx
它给我404找不到错误
It gives me 404 not found error
推荐答案
是的,有区别。
Web服务器正在使用HTTP / 1.1和共享虚拟主机。当客户端连接时,它会发送一个额外的主机:
标头,其中包含用户提供的URL的主机名部分。
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.
Web服务器查看标题以找出要提供的虚拟主机数据。
The web server looks at the header to find out which virtual host's data to serve.
在这种情况下,Web服务器配置为识别和提供来自XYZ域名,但不知道任何名为10.0.10.200
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
这篇关于在主机文件中指定IP与直接使用IP之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!