5 ways to edit the Hosts file like renaming sites and redirecting them

    5 ways to edit the Hosts file like renaming sites and redirecting them The Windows Hosts file allows you to define which domain names (websites) specific IP addresses are linked to.
    It may be difficult for some to understand this concept of "name resolution" so a brief explanation is worth it.
    Each website is inside a computer reachable by an IP address.
    To browse a site, however, it was not convenient to type an IP address like 192.168.21.34, because it would have been difficult to remember.
    So an association was created between these numeric addresses and a word, like pippo.com, which is called domain.
    They are called DNS server those computers located around the world where all the associations of billions of sites are present and make sure that, by opening the browser, just write google.com to open Google or facebook.com to open Facebook.
    DNS is the central addressing system and is a network parameter I have already talked about (for example, setting the DNS with OpenDNS or SecureDNS allows you to filter dangerous sites).
    In the Windows hosts file the same thing happens, locally and only for that computer and takes precedence over DNS.
    You can therefore do some tricks using the hosts file like change the address of a site, block navigation on some web pages locally, redirect websites, create links to websites, create your own local domains, and more.

    To edit the Windows Hosts file you have to open notepad or Notepad (or any other text editor like Notepad ++), as administrator.
    Then click on the Start menu, type notepad in the search box, right click on the link and select "Run as administrator".
    Go to File> Open in the Notepad window and browse the Windows folders to the following destination: C: WindowsSystem32driversetc and open the file called hosts.
    If you do not see it, search for it instead from Windows Explorer and then, once you find it, right-click on it, select Open with and choose the notepad.
    As it is a hidden file, open a folder, go to Tools -> Folder Options, go to the View tab and select the "Show hidden files and folders" option.

    Any changes made to the hosts file take effect immediately after saving the file so there is no need to reboot the system.
    If adding multiple entries to the hosts file, make sure that each is on its own line and that there is no hash sign in front (otherwise they have no effect).
    To make the space long, you have to press the Tab key.
    If you have installed programs like Spybot, you will see many lines already added starting with 127.0.0.1; those are all dangerous sites that are blocked locally for security.

    1) To block a website, just add a line similar to the following at the end of the hosts file:
    127.0.0.1 esmpio.com
    127.0.0.1 is the IP address of the computer you are using so, if you associate the example.com domain with the IP address of this computer, it is obvious that it will not exist and the connection will immediately fail blocking the loading of the site web.
    There is no way to visit that site other than by removing that line from the hosts file.
    This use had already been explained in the past in the article "Prevent the browser from opening and browsing virus sites from the hosts file"

    2) Create website block lists
    As mentioned above, a program like Spybot (one of the best anti-spayware and malware programs) creates a list of domains to be blocked for security reasons.

    3) Another trick that can come in handy is to redirect a website by changing its domain name.
    With the same principle as before, it is possible to define a rule so that, if you type facebook.com on the browser, the Google site opens instead.
    To do this you need to know the IP address of the target site which can be easily found using the Ping command in the command prompt.
    From the Start menu, type cmd in the search box or in Run, open the prompt, type ping google.it and press Enter
    The result will be a response from 173.194.35.184 which is the IP address to use in this example.
    In the hosts file you can then write:
    173.194.35.184 facebook.com
    This line tells our computer to connect to the site at Google's IP address when visiting facebook.com.

    4) With the hosts file, I always add a trivial line to the text file, you can too create shortcuts to get to a site.
    For example, it is possible to associate the "n" with convertresources.com or the g with Google.it.
    In this way, only by writing the n by pressing enter on the address bar of the browser, any browser, you can navigate on convertresources.com.
    It is possible to create links with multiple letters, such as twit to get to Twitter.com or simply Facebook to get to Facebook.com (thus deleting the extension .com, .net, .it etc.).
    To create shortcuts to websites, just add a line like:
    173.194.35.184 g (173.194.35.184 is the IP of Google.it, found using the Ping command as in point 2).

    5) Assign local domain names if you are using a local server.
    Generally this is convenient in offices but also at home it can be useful to reach the router configuration panel.
    So if, for example, the internal address of the router were 192.168.0.1, on the hosts file you can add a line that says:
    192.168.0.1 router
    On the browser, just write the word router in the address bar to open the configuration panel.

    To revert all changes made, just delete the lines added to the end of the file and save it.
    If you feel bad about editing the text file, you can edit the Hosts file with a program such as Hostsman which allows you to add or delete lines from a more convenient configuration window.
    Hostsman is a small free tool that allows you to edit the hosts file in a more intuitive way and that includes some lists of domains to be blocked for security reasons.



    add a comment of 5 ways to edit the Hosts file like renaming sites and redirecting them
    Comment sent successfully! We will review it in the next few hours.