Posted on 2019/01/21 at 5:33 pm
The hosts file is used to map hostnames (in other words domains) to IP addresses. With the hosts file you can change the IP address that you resolve a given domain name to. This change only affects your own computer without affecting how the domain is resolved worldwide. This is particularly useful when you wish to see how a website will look like when hosted on a different server without making any DNS changes to your domain.
The location of the hosts file, depending on the operating system that you are using, is:
To set this up, all you do is use a text editor and use admin privileges as needed to edit the file. From there, we use the following layout:
It's worth noting that you can not add an IP port here and some names you give as the domain don't always redirect if you're going to a site than sinking it to your localhost address. Also, if you have a local server, simply append the port to the domain when accessing it. So, http//webfm.com; via the browser would look like:
That's it, this is a quick rundown of the hosts file and how it can be used.