In this tutorial, you will be shown how to modify your local hosts file, in order to manually configure where a domain points to on your local machine.
This is useful after (or during) a migration, as you are able to browse and test your website on our servers before the site goes live on your new platform. To discuss [migrating your hosting to ProStack for free], contact us via our website.
Modifying your host's file 'overrides' DNS, allowing you to resolve your site to our servers even if DNS hasn't been pointed to us yet.
Step 1 - Run Notepad as Administrator
You will need to open up notepad as an administrator to be able to edit the hosts file. Notepad is located in Start > Accessories > Notepad. Or you can search for "notepad" in the start menu search bar.
Right-click on notepad, and select "Run as Administrator".
Step 2 - Locating the hosts file
Click on File > Open in notepad, and paste in this directory under "File Name" : %systemroot%\system32\drivers\etc\
Click open.
Make sure "All Files" is selected in the drop down box on the bottom right. It will then display the files in that directory.
Double click on "hosts" to open up the hosts file for editing. The file will look like this:
Step 3 - Editing the hosts file
You can place the IP address and the domain name at the bottom of file- see the example above. We will provide you with the IP address you will need to use.
The format of the file is simple:
<ip address> <hostname>
The hostname is the URL you wish to preview- in most cases it will be your site URL. You can have more than one hostname per line. It's a good idea to add both the bare domain (e.g. example.com) and the www prefix (e.g. www.example.com) in the same line.
Once you have entered this in, save the file.
Your domain name will now point to the IP address. You might need to clear your cache- try closing and re-opening your web browser- before the changes take effect.
Once you have finished testing your website be sure to remove the line you added and re-save the hosts file.
TIP: Try our [Preview URL Tool] for an easier way to test sites before they go live! More information can be [found here].
Need further assistance?
If you have any questions on this or feel it's missing something, please get in touch with our support team. Get in touch today!