How to test your website before changing DNS

Overview

A 'hosts' file is a text file on your home computer. It is used to map a domain name to a specific server. If you edit it, you can change where your computer searches for a website.

For example, when you look up a URL in your browser, your computer sends out a query into the Internet to find where your site is located. Your site is located where your DNS is pointed to. If you edit the 'hosts' file, you can change where your computer searches for a website.

In this way you can view a site on your server when the DNS is pointed to another company.

This article explains how to view your site before pointing your DNS to GreenixMedia by editing the 'hosts' file on your desktop or laptop computer (not a mobile device).

Locate your A records

Each site at GreenixMedia has two A records for the URL. One for your domain with and without www. For example:

  • 208.113.137.245 example.com
  • 208.113.137.245 www.example.com

Make a note of these as you'll need to add the IP to your 'hosts' file in the next step.

Using Windows 7 & 8.1

On most Windows systems, you can find the hosts file in the following directory:

C:\Windows\System32\Drivers\etc

It might be set to hidden so make sure you have 'show hidden files' turned on.

Notepad is a basic text editing program that is already install on Windows. To open the 'hosts' file with Notepad, follow the steps below:

  1. Open the 'Start' menu.
    01 Hosts file Windows.png
  2. In the search box, type in 'notepad'.
  3. Right click on the 'Notepad' option and choose 'Run as administrator'.
    This opens a blank Notepad file
  4. On the top left of this blank file, click the 'File > Open...' menu option.
    02 Hosts file Windows.png
  5. In the 'Explorer' window, navigate to the C:\Windows\System32\Drivers\etc directory.
  6. Choose the 'hosts' file and click Open.
  7. At the bottom of the file, add your GreenixMedia site IP followed by the domain.
    208.113.137.245 example.com 
    208.113.137.245 www.example.com
  8. Save the file.
  9. Finally, make sure to flush your computer's DNS to ensure the new settings update.
    • Flush DNS
  10. Restart your browser and try accessing your domain.

You can now view your site as it appears on your Greenixmedia server. Once you point your DNS to GreenixMedia, you can then remove these lines.

Using Windows 10

On most Windows systems, you can find the hosts file in the following directory:

C:\Windows\System32\Drivers\etc

Notepad is a basic text editing program that is already install on Windows. To open the 'hosts' file with Notepad, follow the steps below:

  1. Open the 'Start' menu.
    View hosts file Windows10 01.png
  2. Start to type in the word 'notepad' and it will display the icon.
    View hosts file Windows10 02.png
  3. Right click on the 'Notepad' option and choose 'Run as administrator'.
  4. You may receive a pop-up message titled “User Access Control” asking, “Do you want to allow this app to make changes to your PC?” Click Yes. This opens a blank Notepad file.
  5. On the top left of this blank file, click the 'File > Open...' menu option.
    02 Hosts file Windows.png
  6. In the 'Explorer' window, navigate to 'This PC'. Then to the C:\Windows\System32\drivers\etc directory.
    notepad all-files dropdown
  7. Choose the 'hosts' file and click Open. You may need to change the “Text Documents (*.txt)” in the lower right to All Files in the dropdown list.
  8. At the bottom of the file, add your GreenixMedia site IP followed by the domain.
    208.113.137.245 example.com 
    208.113.137.245 www.example.com
  9. Save the file.
  10. Finally, make sure to flush your computer's DNS to ensure the new settings update.
    • Flush DNS
  11. Restart your browser and try accessing your domain.

You can now view your site as it appears on your GreenixMedia server. Once you point your DNS to GreenixMedia, you can then remove these lines.

Using Apple Mac OS

  1. Launch Terminal by pressing command (⌘) + spacebar which opens the search box.
    04 DNS hosts.fw.png
  2. Type the word Terminal.
  3. Press the return key or click the Terminal icon beneath TOP HIT.
    06 DNS hosts.fw.png
  4.  This example uses the nano editor.
    07 DNS hosts.fw.png
    Type the following into your terminal:
    [server]$ sudo nano /private/etc/hosts
  5. Enter the administrator password. Note: Typed passwords are not displayed on the command line.
    08 DNS hosts.fw.png
  6. Once the hosts file is open, use the arrow keys to navigate to the bottom to make any modifications.
  7. When finished, save and close the file to return to your terminal prompt.
  8. Finally, close Terminal when finished.

Make sure to flush your DNS to ensure the new settings update. Once you point your DNS to GreenixMedia, you can then remove these lines.

Using Linux

On most Linux-based systems:

  • The hosts file can be located in the /etc/ directory.
  • The hosts file is usually called hosts.
  • The full path is /etc/hosts.

The steps to edit and save the file are the same as the 'Mac OS' instructions above.

If you must update something, make sure to document any change so we can separate what may have been affected by the migration from subsequent alterations on your end.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

What is DNS propagation and why does it take so long?

'DNS propagation' is a term used to describe the time frame after making any changes to your...