The hosts file is used by your computer to lookup/resolve domain names to an IP address. This file can be used to force your computer to resolve your website to a specific IP address rather than resolving your website using the DNS found in the name servers the domain is pointed to. Manually configuring your domain with the IP address of your Hosting server, will allow you to test your website without affecting the server where your domain is pointed to via the name servers/DNS.
Edit Hosts File
- Open the Terminal application.
You may either type Terminal in the Spotlight search or by navigating to Applications -> Utilities -> Terminal.
- Open the hosts file for editing.
In the terminal window you just opened copy/paste the command string below, and press return.
sudo nano /private/etc/hosts
You’ll be prompted to enter your Mac user’s password.
NOTE: you will not see the cursor move. This is normal, simply enter your password and press the Return when done.
- Edit the hosts file by adding these two lines to the bottom of the file.
For example, it should look like:
NOTE: Be sure to replace domain.com with your actual domain name. If you are not sure which IP address to use, please contact our Support Department for further assistance.
WARNING: Be sure that there is a space between the IP and the URL. Otherwise, the rule will not work.
- Save your changes by pressing control-o on your keyboard then return to accept the filename. Exit the editor by pressing control-x. This takes you back to the terminal screen.
- You may need to flush your Mac’s DNS cache, so copy/paste the below command string into terminal, and press return.
You may have to add sudo to this command, for example:
sudo dscacheutil -flushcache
This completes the hosts file modification, so you should now be able to see your site here with us using your domain in your browser’s address bar.
When testing is complete you may undo these changes by repeating the steps above but removing the information entered in step 3.