Creating a Hosts File Entry
If you wish to access your website before your DNS has been updated you can update your local hosts file, which will allow your computer to view your new website. Follow the appropriate instructions below replacing <your-website-name> with the domain name you have for your new website (e.g. my-new-website.com)
OSX:
-
- Open Terminal
- Type ‘sudo nano /private/etc/hosts’
- Press Ctrl+Shift+V to take you to the end of the file
- Enter the text ‘xxx.xxx.xxx.xxx <your-website-name>’ replacing the xxx’s with the correct IP address for the server which hosts your website, and replace <your-website-name> with the domain name for your website, eg. my-new-website.com
- Press Ctrl+x to exit
- Press y to save
Example host file entries:
# Text from a "#" character until the end of the line is a comment, and is ignored 127.0.0.1 localhost # example format # xxx.xxx.xxx.xxx <your-website-name> # access my website before the DNS is working 192.0.2.175 my-new-website.com
Alternatively, you can download the macOS Hosts preference pane helper from here:
https://github.com/specialunderwear/Hosts.prefpane/
Windows:
-
- Click “Start” button
- Click “All Programs”
- Click “Accessories”
- Right-click on Notepad and then click Run as administrator.
- If you are prompted for an administrator password or for a confirmation, type your password, or click Allow/Yes.
- Open the Hosts file. Discover the location for your version of windows here (https://en.wikipedia.org/wiki/Hosts_(file)#Location_in_the_file_system
- Enter the text ‘xxx.xxx.xxx.xxx <your-website-name>’ replacing the xxx’s with the correct IP address for the server which hosts your website, and replace <your-website-name> with the domain name for your website, eg. my-new-website.com
- Click Save on the Edit menu. (If using Windows 7, you will need to click Save on the File menu.)
How to locate your hosting server IP address
Please read this article on How to locate your hosting server IP address