For example, if we migrate your website, before we give you the confirmation we edit the hosts file on our computer to check that it works fine and there are no errors. This is the case when you decide to change hosting or when you are transferring your site from Blogger to WordPress. Moving files can be done manually or through a plugin, such as Duplicator, that simplifies the process. When moving a site from one server to another basically what happens is a physical transfer of all files from one remote server to another, these servers are identified by unique IP addresses. Thanks to this modification we can check that everything is working properly before we change the domain pointing and show our website to the world. There are some cases in which we cannot do without editing the local hosts file. Once we understand what we need to edit this file on our computer for, let’s see in what cases it can come in handy. In this way only we see the site in staging, and we can do all the tests we want without creating problems to the site in production. In this case we tell our computer, by adding a line on the hosts file, that when we visit the site we want to see the site that is hosted on the server 222.222.222.222 instead of what the domain shows us hosted on 111.111.111.111 In practice we use a second server as staging, that is a test installation where we can do all the tests we want without risking to do damage.
![how to add to windows host file how to add to windows host file](http://1.bp.blogspot.com/-NHIOSSOFhss/UwuaF1h0bVI/AAAAAAAABK0/4g0yyyN4pxI/w1200-h630-p-k-no-nu/kbkoreanblack[1].jpg)
We now want to work on the second site, make some changes and then decide whether to apply them to our main site or not. The domain still points to the first server. Now we end up with two identical sites, but no one will know that the second one exists, since we haven’t changed the pointing of the domain. We want to make a change, and to do so we decide to create a copy of the account on another server, which has IP 222.222.222.222 The domain points to the IP 111.111.111.111, so when a visitor visits the site he sees the site staying on this server.
![how to add to windows host file how to add to windows host file](https://www.droidviews.com/wp-content/uploads/2017/01/lgv20_signature_droidviews_03.jpg)
![how to add to windows host file how to add to windows host file](https://files.structurae.net/files/photos/5256/2015-06-11/dsc07182.jpg)
We have the site visible to all, the server on which it resides has IP 111.111.111 It is a file in our computer, which we can modify according to our needs and allows us to tell our computer to display the site on a specific IP when we visit it. In this case the hosts file comes to our aid. What it is for and why you should edit the hosts file
![how to add to windows host file how to add to windows host file](https://windows-cdn.softpedia.com/screenshots/Master-PDF-Editor_4.png)
When we change the pointing of the domain we must be sure that the site on the new server works correctly, to avoid sending our visitors to a site that gives an error. This uses an easy-to-remember name to reach a specific numeric IP address that would be difficult to remember. They are called DNS servers those computers located around the world in which are present all the associations of billions of sites and make sure that, opening the browser, just write to open Google or to open Facebook. That’s why an association (name resolution) was created between these numeric addresses and a word, like, which is called domain. To navigate on a site, however, it was not convenient to write an IP address like 192.168.21.34, because it would be difficult to remember.
How to add to windows host file how to#
How to edit the hosts file on your computerĮach website is hosted inside a remote computer (server) reachable by an IP address.Staging environment on a different server.What it is for and why you should edit the hosts file.