Your host file is typically located within c:\windows\system32\drivers\etc\hosts. If you don’t see it there, other possibilities are as follows:
Best practices would suggest you to backup any file before you make any edits, whether that’s a WordPress plugin, core or theme file. Here’s the naming convention that I recommend: name_file_yyyymmdd. Here’s an example id I were to do this backup today: host_file_20171109.
Follow these steps:
Now that the backup is complete, navigate back to the location of the original host file. Since host files are not in a standard .txt file format, we will need to select the program we would like to open the file with. I suggest using Notepad since the program is installed with the Windows operating system and it’s easy to use. Right-click on the host file and selecting Open With from the right-click menu. From the right-click menu, select Notepad.
Within your hosts file, you should see something like the following:
Below the last # symbol, enter the IP Address of the development or testing server. You should enter two lines, one for the www version and another for the non-www version.