如果我修改我的/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
更改为:
##
# 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
127.0.0.1 www.microsoft.com
这会将任何访问 的尝试重定向www.microsoft.com
到127.0.0.1
,从而有效地阻止对 的访问www.microsoft.com
。效果很好。
现在,我不想重定向到本地主机,而是想重定向到另一个网站,例如,我想将 /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
www.google.com www.microsoft.com
但是,当我尝试访问 时www.microsoft.com
,它永远不会将我重定向到www.google.com
。它只是直接转到www.microsoft.com
并忽略我在 中执行的操作/etc/hosts
。
有人知道如何解决这个问题或者如何实现这个目标吗?