Home > Article > System Tutorial > Graphical tutorial on modifying the hosts file to block websites in WIN7
When you have problems accessing certain websites or want to block specific websites, modifying the hosts file can provide an effective solution. PHP editor Baicao will use this article to explain in detail the steps to modify the hosts file to block websites in Windows 7.
Find the hosts file. In the 32-bit system of Windows 7, the location of the hosts file is under the [C: WindowsSystem32driversetc] folder.
Right-click the hosts file, select the Open option, and Select [Notepad] in Open with.
After entering the editing mode using Notepad, enter the URL you want to block and an IP that is not the website on the network, as shown in the picture. The editor uses 127.0.0.1, which is the address of this machine.
After adding it, click [File] → [Save As] and select a save location. The location chosen by the editor is the desktop. Note that the name of the file should be written as [hosts] at this time.
At this time, a [hosts.txt] file will appear on the desktop. Rename it and remove its suffix.
Copy the obtained file to the directory where the hosts file is stored, which is [C: WindowsSystem32driversetc], and overwrite the original file.
At this time, enter the URL in the address bar of the browser, and you will find that we can no longer enter the homepage and have successfully blocked it.
Note:
To unblock, you only need to delete the corresponding entry or add]#[ in front of the corresponding entry.
The reason why it cannot be saved directly is that Windows does not allow direct modification of the hosts file, and ordinary users do not have permission to save the file in the directory where hosts are stored, so it can only be modified by overwriting.
The above is the detailed content of Graphical tutorial on modifying the hosts file to block websites in WIN7. For more information, please follow other related articles on the PHP Chinese website!