View website before going live

When setting up a new website or moving to a new server you need to view your website, before DNS Propagation, using the new server as a testing or developer environment.



Since EasyApache 4 became stable with the release of version 58 at the end of 2016 it is now the default for cPanel & WHM, the changes are major improvements, such as multiphp and automatic updates as well as not having to recompile to make minor mods, much faster speed, etc


One change has been you can not simply click on the IP address from Account Information > List Accounts, prior to DNS propogation.



There are a number of methods of previewing your website under development, before DSN propogation, such as using Apache mod_userdir Tweak, but rather than server changes (risk is you omit to reset once live). The easiest method I have found to view a website before changing DNS is to modify the Hosts file on my local computer, explained here.



Here we are using Windows 10, it also works in similar manner from Windows 7 onwards



Step 1.


Use search to locate notepad.


    


Step 2.


Open notepad - right click to Run as administrator





Step 3.


On File menu click open and navigate to C:\Windows\System32\drivers\etc





Step 4.


The etc folder appears empty, go to bottom right and change the file type from Text Documents (*.txt) to All Files
Click on hosts file to open.





Step 5.


At the bottom of the hosts file add your IP spacebar then www.yourwebsite.com spacebar yourwebsite.com.

For multiple domains use a new line for each. They may have the same IP or different IP addresses.






Step 6.


Once you have finished adding your domains you can save the file. not as a text file (default) but as All Files






Step 7. optional


You may wish to check that your hosts file is working as expected.


Open Command Prompt and run TRACERT (tracerout) to verify your browser will go to your new website and not the old or existing one
here's how (click any image & use arrows to navigate images)



              


Step 8.


Once you make your new website live and DNS has propogated (up to 24 hours) don't forget to remove the entries from your hosts file