If you would like to set up pre-published viewing for your website before you officially point your domain to your new hosting provider, you will need to modify the host file on your computer. This is the recommended method for pre-published viewing.
Modify Your Host File on Windows
Follow the instructions below to modify your host file on Windows. This method applies to any version of Windows, XP or newer.
Open Windows File Explorer and go to Computer > Local Disk (C:) > Windows > System32 > drivers > etc. If this folder appears empty, continue on to Step 2 below. If you see a file called “hosts,” skip to Step 4.
Go to the View tab in the File Explorer and click Options > Change folder and search options as shown below (Windows 10, 8.1, 8), or open the Control Panel and click Folder Options (Windows 7, Vista, XP).
In the Folder Options window, go the the View tab. In the Advanced Settings list, select the Show hidden files, folders, or drives option under Hidden files and folders. Click OK to save your changes and close the Folder Options window.
Press the Windows key or open the Start Menu and search for “Notepad.” Right-click Notepad and then click Run as Administrator.
In Notepad, click File > Open and select All Files from the File Types drop-down as shown below, then enter C:\Windows\System32\drivers\etc\hosts in the File name field and click Open.
At the end of the hosts file, below the existing text, enter your StudioPress Sites IP address (this can be found by logging into your StudioPress Sites portal) followed by a space and <yourdomain.com>, another space, and <www.yourdomain.com>. It should look like the example below, replaced with your IP address and domain:
18.104.22.168 yourdomain.com www.yourdomain.com
Save the file and close Notepad. Clear your browser cache, then restart the browser. You should now be able to access your website by entering your domain into the URL field. Note that this new StudioPress Sites installation is accessible only to you, because you’ve modified your host file. When you are ready to officially publish your website, you must update your DNS records to make your site publicly available.
Remove Your Host Entry
When you are ready to update your DNS records and make your StudioPress Site publicly available, you should remove your host entry so that you are able to test your DNS settings and spot any issues with the process.
To remove your host entry, follow Steps 1 through 5 above (if you’ve already updated your hidden file settings, you should be able to skip steps 2 and 3) to open your host file in Notepad, then delete the entry you made for your StudioPress Sites website. Save the file and close Notepad. Your host file is now back to normal and you can begin the DNS mapping process.