Friday 6 October 2017

How to make changes in your hosts file: Windows OS?

In some client requirements client asks to change the hosting server of websites, in those cases before making the CNAME/nameserver changes in domain settings, we made changes in the host file of local system to upload the website to new server before making everything live or making such changes in the live/production server.

To make changes in your host file in Window OS, please follow the below steps:

  1. Click on start menu and type "notepad".
  2. Right click on it notepad and select the option "Run as administrator".
  3. Now press "CTRL+O" to open the file.
  4. In file name input box copy this line "C:\Windows\System32\drivers\etc\hosts" and press enter.
  5. As the hosts file has been open now scroll till the end.
  6. At the very bottom you need to define two things, first is the IP of hosting server and second is the domain name, in our case (demonstration) I have one website running "www.amitwalia.info" which is hosted on google and one hosting which is localhost (implemented using WAMP).
  7. Now Localhost in most of the case point to "127.0.0.1" IP, in our example I will divert the www.amitwalia,info website to our localhost IP.
  8. Now in your hosts file at the very bottom first specify the new hosting server IP then mention the domain name like mentioned below.

  9. 127.0.0.1       www.example.com

  10. Now save the file and go to your browser, clear the caches and visit your www.example.com
  11. And you are done! You can also use this method to block some websites on your system.



Please find below the video demonstration of the points mentioned above as a quick review.



Load disqus comments

0 comments