How to view your DreamHost site using your hosts file

Using your hosts file

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 DreamHost server when the DNS is pointed to another company.

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

To test on a mobile device, or for another option on how to view your site at DreamHost before pointing DNS, view the following article:

Locate your A records

Each site at DreamHost 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

View the DNS article for details on how to view these records. 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 DreamHost 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.
  10. Restart your browser and try accessing your domain.

You can now view your site as it appears on your DreamHost server. Once you point your DNS to DreamHost, 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 popup 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 the C:\Windows\System32\Drivers\etc directory.
  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 drop-down list.
  8. At the bottom of the file, add your DreamHost 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.
  11. Restart your browser and try accessing your domain.

You can now view your site as it appears on your DreamHost server. Once you point your DNS to DreamHost, 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. View the 'Creating and editing a file via SSH' article for instructions on how to edit this file. 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 DreamHost, 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.

WordPress migration instructions

This section explains how to view your WordPress site (at DreamHost) if it was migrated by the Professional Services Team. This section only applies to NON-DreamPress migrations.

First, read through the sections above to locate and edit your computer's 'hosts' file.

Normally, updating a 'hosts' file only requires you to add two lines (as mentioned above). With this migration process, you also need to add a third line of text for the MySQL server. For example, if your site was example.com, you would add these lines to the bottom of your 'hosts' file:

111.111.111.111 example.com
111.111.111.111 www.example.com
222.222.222.222 mysql.example.com

Replace the example IP addresses above with your site's actual IP addresses. You can find them in the DreamHost web panel on the (Panel > 'Domains' > 'Manage Domains') page. Under your domain name, click 'DNS' link. 

If you need further assistance locating your site's IP addresses, view the 'DNS' article for more detailed instructions.

Confirming the 'hosts' file is working

You can confirm you are loading the migrated site from DreamHost's servers if you are able to load the following page (replacing “example.com” with your domain):

  • http://example.com/dhwpmigrate.html

View your public site through a proxy

Once your 'hosts' file is working, your computer will show you how your site looks at DreamHost. If you want to also view your current (public) site, you must use a proxy website.

An example of a proxy site is http://kproxy.com. Visit that link in your browser, enter your domain name in the box, then click 'Enter'. It uses your site's public DNS (not your local 'hosts' file) to view the site at your current hosting company.

Comparing the sites

Viewing your site using a 'hosts' file and a proxy site allows you to view both versions of your site for a side by side comparison. You can have one browser tab open on the migrated site (viewed using your 'hosts' file) and another browser tab open on the proxy site (viewed using DNS) to see your current public site.

Making further changes to your site

During your inspection of the site, you may feel the need to change the setting of something that was out of scope of the migration service. Please refrain from changing anything that may alter the look or behavior of the site since the Professional Services Team must be able to compare the migrated site (at DreamHost) to the live site (at your current host).

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

See also

Did this article answer your questions?

Article last updated .