为什么我的主机文件不再重定向?

Why doesn't my hosts file redirect anymore?

我是 Mac OSX 并且我之前已经多次编辑我的主机文件并且它总是有效。但是突然间我再也得不到我想要的结果了。

目前/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。我重新启动了浏览器和整个笔记本电脑,但没有任何变化。

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

/etc/hosts 文件的语法是

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

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