Certain web services like skipdns.link will allow you to input a domain and an IP, then return a temporary link to view a copy of the site.
This is useful for verifying basic content but not for web development, as the site is read-only. For development, we recommend using the Hosts file method.
Editing your Hosts file is the best way to preview a new version of a website while keeping the live version of the site accessible to all other users.
Whenever a website is loaded, your computer will perform a DNS lookup to find the IP of the server the website is hosted on. Before this, it will check in a local Hosts file to see whether it already has that information.
By adding an entry to this file, you can force your computer to attempt to load any domain from any server. Once done, you can simply remove the record and the computer will perform a lookup as normal.
Your hosts entry will consist of the IP address of the server, and the domain name(s) you wish to load from that IP.
For example:
103.26.236.255 yourdomain.net.au www.yourdomain.net.au
You can find your server IP in cPanel, or in the email, which contains your Hosting account login details.
Step 1 - Click on Start, type in Notepad then right click and select Run as Administrator.
Step 4 - Start a new line at the bottom of the file and enter the new entry.
An example entry would be:
103.26.236.255 yourdomain.net.au www.yourdomain.net.au
Step 5 - Save the file by going to File > Save in Notepad.
Note: You can disable this hosts file entry once it is no longer needed by repeating steps 1-3, and adding a # to the start of the line you added. You could also delete the line from the hosts file entirely. Remember to save your changes.
sudo nano /etc/hosts
Step 3 - Start a new line at the bottom of the file and enter the new entry.
An example entry would be:
103.26.236.255 yourdomain.net.au www.yourdomain.net.au
dscacheutil -flushcache
Step 6 - Hit Enter/Return.
Note: You can disable this hosts file entry once it is no longer needed by repeating steps 1-2, and adding a # to the start of the line you added. You could also delete the line from the hosts file entirely. Remember to save your changes as shown in step 4.
The cPanel documentation on this legacy method can be found here.
cPanel does not recommend or provide support for this method, and it is not enabled on our services for security and functionality reasons.
Since modern CMSs like Wordpress have references to the full site URL in their site files and database, a user's browser is directed to download resources at time of page load. Using this method, the non-live site will load resources from the live version instead which defeats the purpose of a temporary domain.
A developer could theoretically get around this by updating every instance of the site url to the temporary domain, but doing so is beyond the scope of this guide.