Read this support article about...
Your machine's local hosts file allows you to overide DNS for a particular domain or subdomain name.
This is a great way to test the site ahead of changing real DNS: you're able to test the website at CreateTheWeb while the rest of the internet continues to use DNS to point to the existing website.
The way to modify this file and the location of it differs by operating system.
To modify your hosts file, you can add two entries to the file that contains the IP address that you want the site to resolve to and the IP address. Adding the following two lines, for example, would point www.domain.com and domain.com to the IP 188.8.131.52:
184.108.40.206 domain www.domain.com
sudo nano /etc/hosts
To save changes in nano, press Control+x and then y when prompted.
sudo nano /private/etc/hosts
To save changes in nano, press Control-x and then “y” when prompted.
/etc/hosts (i.e sudo vim /etc/hosts)
The hosts file takes arguments of the format:
XX.XX.XX.XX domain.tld www.domain.tld
The IP address for the website is displayed down the right hand side of our control panel, under the 'IP Address' heading. They'll usually start with '185.151.2x.xxx':
185.151.2x.xxx domain.tld www.domain.tld sub.domain.tld
After you add this line and save the file, your system begins resolving to the specified IP address.
After testing is finished please remove these entries so you start using “real DNS” once again.
It's important to ensure that when making this change you have entries for both your domain and all relevant subparts. For example, if you just add an entry for “domain.tld”, then “www.domain.tld” will point the original server.