search

Home  >  Q&A  >  body text

Why does my hoste file return to its original appearance when I reopen it after modifying the access domain name and saving it? ?

QQ截图20170831114730.png

phpcn_u16503phpcn_u165032650 days ago2336

reply all(2)I'll reply

  • Day

    Day2017-08-31 13:02:19

    It may be caused by the read and write permissions of the permission text of the C drive. You can try to copy the file to the desktop, add the domain name to save it, and paste it into the system of the C drive.

    reply
    0
  • phpcn_u16503

    phpcn_u165032017-08-31 12:15:28

    After searching the Internet for a long time, I finally found the answer

    Author: Panfeng Li
    Link: https://www.zhihu.com/question/40971769/answer/97927205
    Source: Zhihu
    Copyright belongs to the author. For commercial reprinting, please contact the author for authorization. For non-commercial reprinting, please indicate the source.

    Generally, modification of the /etc/hosts file under LINUX will take effect immediately. Even if it does not take effect occasionally, just restart the network service. However, Windows will encounter such problems, and there are slight differences in different versions of the system. Before solving the problem, let us understand the knowledge of dns and hosts. We know that when visiting a website, we must first resolve the domain name to be accessed into an IP address through the DNS server, and then we can see the page content of the website we are visiting in the browser. According to Windows system regulations, before making a DNS request, the Windows system will first check whether there is a mapping relationship between network domain names in its Hosts file. If there is, this IP address mapping is called. If no domain name resolution is proposed to the known DNS server, it means that the request level of Hosts is higher than that of DNS. First of all, we need to know the location of the hosts file. Find the following location C:windowssystem32driversetc in systems such as Second, modify the hosts file correctly. Generally, there will be an example in the hosts file, such as 64.233.162.83 http://google.com means that opening the URL http://google.com will resolve to 64.233.162.83. There must be at least one space between the IP address and the URL. In addition, be sure to add it when writing the mapping in the last line. Press Enter and save to avoid the last line not taking effect. If a record is not used temporarily, just add a # sign in front of it.

    The hosts file has hidden attributes by default. It cannot be seen under the system's default settings. The solution is to open My Computer-click Tools-Folder Options-View-uncheck Hide protected system files and confirm. . If the modification cannot be saved, please right-click on the Hosts file-Properties-and remove the read-only attribute to save it. When modifying the HOSTS file, we often encounter situations where the modification is invalid after saving. We can use ipconfig /flushdns command to refresh the dns cache, or you can open the service in the management tool and find the DNS Client disables it and changes it to manual mode to start after modifying hosts. Note: When you modify the hosts file while the browser is open, the system will release the memory occupied by the hosts file only when the browser is closed. When we open the browser again and access it, we find that it has taken effect. If you encounter windows 7 If the operating system cannot be opened and edited, it is usually caused by the security mechanism UAC. You can hold down the Shift key, right-click on the Hosts file, and run it in administrator mode. Or modify the Hosts file permissions, add the currently logged in account to the security tab, and grant write rights.


    reply
    0
  • Cancelreply