Navigate to your hosts file

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:

Backup your hosts file before you start editing

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:

  1. Located the host file using the steps above.
  2. Right-click on the file and select Copy.
  3. Go to the Desktop or any location where you want to store the backup file.
  4. Right-click and select Paste.
  5. Right-click on the file and select Rename.
  6. Change the file name using the suggested naming convention above (name_file_yyyymmdd)
  7. Hit Enter on your keyboard or click somewhere on your Desktop away from the file to save the new name.

Opening your hosts file

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.

Modifying your hosts file

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.