I had to modify the hosts file on a Windows 10 machine, but the changes were ignored all the time. It took me literally 1 hour to found out why it didn' t work. The client PC was running Windows 7 before and upgraded to Windows 10. He had 2 windows folders.
Usually I navigate to this folder by typing it in the file explorer:
The host file was indeed located here. But the changes did not affect. The problem was that there were multiple Windows directories so this one was unused.
To make sure that you will always get the proper hosts file, go to this location by using the %SystemRoot% environment variable:
For more generic information about the hosts file, visit this Wikipedia article.