1. Home
  2. DNS
  3. Previewing your domain

Previewing your domain

Overview

Often times when switching hosting companies we would like to see what your domain name looks like before finalizing DNS changes by changing nameservers. Overriding DNS is done through a HOSTS file. Any entry in a HOSTS file overrides any other DNS setting that is resolved by a nameserver.

Making Adjustments

A HOSTS file location depends upon the operating system. All HOSTS files retain the same syntax:

<IP ADDRESS> <HOSTNAME>

For example, the following line will force apnscp.com to resolve to 64.22.68.1:

64.22.68.1 apnscp.com

Visit http://apnscp.com to access apnscp.com on the server with an IP address 64.22.68.1. Your server IP address can be found within the control panel under AccountSummary > General InformationIP Address.

Microsoft Windows Vista, Windows 7+

Click on Start menu. Browse to All Programs > Accessories. Right-click on Notepad and select Run As Administrator. If a UAC prompt appears, allow the application to be run as administrator. Go to File Open. Enter %SystemRoot%system32driversetchosts.

Sample hosts file from Windows

Sample hosts file from Windows

DNS will be updated once the file has been saved and Notepad closed.

Mac OS X

Open up a terminal session, then enter sudo nano /private/etc/hosts. Once changes are done, CTRL + O to save, then CTRL + X to exit. To flush DNS cache, once exited from the text editor, issue sudo dscacheutil -flushcache in the terminal.

Linux

Similarly to Mac OS X, open up a terminal session, and enter  sudo nano /etc/hosts. Make changes to the host file, then CTRL + O to save, then CTRL + X to exit. DNS will update automatically.

 

See Also

Updated on March 7, 2021

Related Articles