【问题标题】:Why doesn't my hosts file redirect anymore?为什么我的主机文件不再重定向?
【发布时间】:2015-06-16 07:08:33
【问题描述】:

我是 Mac OSX,我之前曾多次编辑过我的 hosts 文件,而且它总是有效。但是突然之间,我现在不再得到我想要的结果了。

/etc/hosts的内容目前是这样的:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

www.google.nl   www.example.com

但如果我转到 www.example.com,我仍然会得到 example.com 网站而不是 google。我重新启动了浏览器和整个笔记本电脑,但没有任何变化。

有谁知道这怎么可能不再起作用?欢迎所有提示!

【问题讨论】:

    标签: linux macos dns ip hosts


    【解决方案1】:

    /etc/hosts文件的语法是

    IP[tab]DOMAIN[tab]ALIAS1[tab]ALIAS2...

    如果您希望 www.example.com 将您重定向到 www.google.nl,您必须解析 www.google.nl,获取该 IP 并将其插入您的 /etc/hosts。

    【讨论】:

    • 我的坏。我认为它也适用于域到域。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-24
    • 2014-09-12
    相关资源
    最近更新 更多