Viewing site before DNS change

From DreamHost
Jump to: navigation, search

Overview

When you visit a website, you are redirected to the hosting company where your DNS is pointed. It’s also possible to upload your content to the DreamHost servers before you point your DNS to DreamHost and then view how the site will look on our servers. This wiki walks you through how to view the website you’ve uploaded to the DreamHost servers before this DNS change.

A note about using Dreamhosters.com with a CMS

Some Content Management Systems (CMS) like WordPress have the domain name stored as a setting in the sites configuration file.

You can install and set up your site on a dreamhosters.com subdomain. But when it comes time to migrate the site to the primary domain, you’ll need to update the URLs in the database.

Visit this link at Wordpress for further details on how to move the site to a new URL:

Viewing your site through a dreamhosters.com subdomain

For temporary web viewing, you are able to add a subdomain of DreamHosters.com on your Manage Domains page. For example, if your site is named mysite.com, you can set up a dreamhosters.com subdomain such as mysite.dreamhosters.com. Then, set that dreamhosters URL to MIRROR your primary website.

In the example below, your site is named yoursite.com and the dreamhosters subdomain is named yoursite.dreamhosters.com:

  1. Open your (Panel > ‘Domains’ > ‘Manage Domains’) page.
    01 DNS viewing site.fw.png
  2. Make sure your domain is set up as Fully Hosted.
    01 Adding Domain Subdomain.fw.png
  3. Click the Add Hosting to a Domain / Sub-Domain button found at the top of the page.
    The Manage Domains page opens where you can make various changes to your settings:
    03 DNS viewing site.fw.png
  4. Scroll down to the Mirrored section and fill in the two fields:
    • Create the mirror at: Type in the dreamhosters.com address you wish to use. In this case, you’d type in "yoursite.dreamhosters.com".
    • Mirror this site: Select the name of your primary domain to be mirrored.
  5. Click the Mirror this domain button to complete the setup. It may take up to 6 hours for this newly-created mirror to update, but once it does, you'll be able to access your domain (via this mirror) before you change the nameservers to point to DreamHost.

When you are ready to point your DNS to DreamHost, visit the following wiki pages which provide full instructions:

Note2 icon.png Note: Do not try to visit your site at DreamHost by its IP address, as the IP address is for the server, not the website. If you visit the IP, you’ll see a Site Not Found page which you can read about here:


Viewing your site through your hosts file

You are also able to view the site you’ve uploaded to your DreamHost server before pointing your DNS to DreamHost. This can be done using the 'hosts' file on your personal computer.

You'll need to temporarily edit the content of this 'hosts' file. Once adjusted, you'll be able to see your site how it's been uploaded to your DreamHost server, even before the DNS change.

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.

Opening your hosts file

Using Windows

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 'Exporer' 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 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.
    The Terminal prompt opens.
    05 DNS hosts.fw.png
    Enter the following in the Terminal command prompt:
    06 DNS hosts.fw.png
  4. Type sudo nano /private/etc/hosts
    07 DNS hosts.fw.png
  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, press Control + O followed by Enter to save changes to /private/etc/hosts.
  8. Press Control + X to exit out of nano.
  9. Quit 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.

Viewing your MySQL database before DNS change

If you need to access a MySQL database before DNS changes, you can do the same thing by using a "temporary" MySQL host arrangement.

Visit the following wiki for more information:

See also