There may be some cases where you need to test a newly created website but your domain name is not yet pointing to your new hosting servers. To achieve this you need to locate and edit your hosts file , entering in the ip address of your new website and the domain name(s) you wish to resolve too the IP . Examples are given below.
Windows
Open windows explorer and browse to C:/Windows/System32/drivers/etc and open the hosts file with notepad. Scroll down to the end of the file and enter in your websites ip address followed by the domain name you wish to resolve e.g
192.168.1.2 www.newdomain.com newdomain.com
Save and close this file.
When you open the domain www.newdomain.com in your favourite internet browser it will resolve to your new ip 192.168.1.2
Mac OS
Edit the /private/etc/hosts file. Further information on how to use the hosts file can be viewed by opening Terminal and typing: man hosts
Please Note: Editing this file requires root privileges.