When migrating your website, it is absolutely essential to test everything before you update the DNS. However, if your website or CMS uses relative links, using cPanel’s user link won’t let you test your site. The best way is to override the public DNS settings for your domain on your computer.

No matter which OS you are using, the entry into your hosts file is will look the same:

$ipaddress $domain

As an example, encylia would look like this:

209.59.144.119 encylia.com

It’s that simple. The only complexity is in finding your hosts file on your specific operating system. Find your OS below.

Windows 7 and Vista

1. Click Start , hover over All Programs and click on Accessories
2. Right click Notepad and select Run as Administrator
3. Click Continue on the “Windows needs your permission” pop-up window.
4. After Notepad opens Click File, and select ‘Open’.
5. In the filename field enter C:WindowsSystem32Driversetchosts and then click open.
6. Add your entries, and then save the file. You should be able to test now.

Make sure that you remove your entries after you complete your testing.

Windows NT/2000/XP

1. Click Start, hover over All Programs, then on Accessories, anc click on notepad.
2. On the menubar, choose File, and then open.
3. In the filename field enter C:WindowsSystem32Driversetchosts and then click open.
4. Add your entries, and then save the file. You should be able to test now.

Make sure that you remove your entries after you complete your testing.

Mac OS X 10.1.6 to 10.6

In MacOS you must edit the file on the command line, using sudo.

1. From a finder window, go to Applications, then to the Utilities folder, and open a Terminal.
2. Open the hosts file by typing the following in the Terminal window:
sudo nano /private/etc/hosts
Type your user password when prompted

3. Add your entries at the bottom of the file, and press Control+x (at the same time) to execute a save of the file, and enter to exit the file.
4. Make your changes take effect by flushing the DNS cache with the following command:
$ dscacheutil –flushcache

Make sure that you remove your entries after you complete your testing.

Mac OS X 10.0 – 10.1.5

1. From a finder window, go to Applications, then to the Utilities folder, and open NetInfo Manager.
2. Click the padlock in the lower left corner of the window, enter your Admin password and click OK.
3. In the second column of the browser view, select the node named “machines.”
4. Select “localhost” in the third column, choose ‘Duplicate’ from the Edit menu, and click ‘Duplicate’ on the confirmation box, creating a “localhost copy” entry.
5. Double-click the value of the ‘ip_address’ property and enter the IP address that you need to test.
6. Do the same to the ‘name’ property and enter the domain you need to test.
7. Select the ‘serves’ property and choose ‘Delete’ from the Edit menu.
8. Choose ‘Save’ from the File menu, and click ‘Update this copy’ on the alert.
9. Repeat steps 6 through 12 for each additional host entry you wish to add.
10. Once you’re done, select ‘Quit’ from the NetInfo Manager menu.

Make sure that you remove your entries after you complete your testing.

RedHat/CentOS, Ubuntu, FreeBSD, and most other Unix/Linux/*nix-like OSs.

1. Open a terminal (In gnome: Applications –> Accessories –> Terminal)
2. Copy and paste the line below into your terminal, hit enter, and then enter the root password.
sudo nano /etc/hosts
3. Add your entries at the bottom of the file, and press Control+x (at the same time) to execute a save of the file, and enter to exit the file.

Make sure that you remove your entries after you complete your testing.