Support / KnowledgeBase

 
Search the KnowledgeBase Search

How can I test/preview my website before switching DNS?

  • Applies to: (dv) 3.5, (dv) 4.0, (gs)

  • Difficulty: Easy

  • Time needed: 10 minutes

  • Tools needed: None

 
  • Applies to: (gs) Grid-Service
    • Difficulty: Easy
    • Time: 5
    • Tools needed: None
  • Applies to: (dv) 4.0
    • Difficulty: Easy
    • Time: 5
    • Tools needed: None
  • Applies to: (dv) 3.5
    • Difficulty: Easy
    • Time: 5
    • Tools needed: None

There are a few different ways to preview your site before DNS resolves it to your (mt) Media Temple server.

Instructions

On the (gs) Grid-Service, you can use your access domain to preview your site. It will be of the format http://s00000.gridserver.com for your primary domain, or http://alternate.com.s00000.gridserver.com for alternate domains on your server. To find your access domain:

  1. Sign into your AccountCenter.
  2. Click on your primary domain.
  3. Click on Server Guide. Your access domain is shown in the first section.

You can also visit subfolders using the access domain, such as http://s00000.gridserver.com/blog.

You can use your IP address to preview your site, but you must first designate a primary domain for that IP address in Plesk. You can change the primary domain as often as you want, so you can use the same IP to preview different sites.

To define which IP address a domain is assigned to, follow these steps:

  1. Log into the Plesk Server Administration Panel. See Figure 1:

    Figure 1. The Plesk control panel. Click for a larger view.
    Figure 1. The Plesk control panel. Click for a larger view.

  2. Click on Subscriptions. See Figure 2:


    Figure 2: Click on Subscriptions in the left column.

  3. Click on the domain you wish to modify. See Figure 3:


    Figure 3: Click on your domain name.

  4. Click on the tab that reads Change Hosting Settings. See Figure 4:


    Figure 4: Click "Change Hosting Settings" to continue.

  5. Select the new IP address in the drop down menu labeled IP address. See Figure 5:


    Figure 5: In this example, we only have one IP address. If you have purchased additional IP addresses, they will be listed here.

  1. Log into Plesk.
  2. Go to the Server side tab.
  3. Click on IP Addresses.
  4. Click on the number in the Hosting column, on the far right.
  5. Select the appropriate domain, and click Set as Default next to the star.

URL dependency and using your HOSTS file for previews

Certain features on your site may not work as expected if you are not using the actual domain name in the URL.

  • WordPress sites and other websites may force a rewrite of the URL to the domain name, so the site may redirect to your previous host, or may not display at all. You can either temporarily update the WordPress URL to your preview URL, or read below for another option.
  • Files called with absolute rather than relative links will still be pulling data from your previous host.
  • SSL certificates, and visiting sites over HTTPS, will work without errors only with the exact domain name.

To test your website with your own domain name before DNS propagation has completed, you can use your local computer's HOSTS file. Your computer will use the entries in your HOSTS file before it looks up the DNS information for your domain. This article contains instructions for editing the HOSTS file on Windows 95/98/Me/2000/XP/2003/Vista/7, and Apple's Mac OS X.

When you are finished testing, remember to remove the custom lines that you added.

(mt) Media Temple is not responsible for custom configurations on your local computer. If you are uncomfortable with editing configuration files on your computer, please do not follow the instructions below.

Windows

  1. Locate the HOSTS file on your computer. Typically it is in one of the following locations:
    • Windows NT/2000/XP/2003/Vista/7 - C:\windows\system32\drivers\etc\hosts
    • Windows 95/98/Me - C:\windows\hosts
  2. Open this file with a text editor such as Notepad or Wordpad.
    • Right-click on Notepad and select the option to Run as Administrator - otherwise you may not be able to open this file.
    Then, open the file. Consider performing a "Save As" so you have an original copy of the file that you can restore later. You will see two columns of information, the first containing IP addresses and the second containing host names. By default, a windows hosts file should be similar to the following:
    hosts
    127.0.0.1 localhost
    

    You can add additional lines to this file that will point requests for a particular domain to your new server's IP address. Example:

    hosts
    127.0.0.1 localhost
    70.32.88.203 example.com
    70.32.88.203 www.example.com
    
  3. Save your changes.
  4. Restart any currently open browsers. You may also want to flush your DNS cache. In Windows XP, go to Start, and then Run, then type "cmd" and hit enter. Type the following:
    
    ipconfig /flushdns
    
    
  5. Visit your new site using http://example.com/ or http://www.example.com/

Mac OS X

  1. Open Terminal, which is in Applications, then the Utilities folder.
  2. You may want to first make a backup copy of your existing hosts file:
    
    sudo cp /private/etc/hosts /private/etc/hosts-orig
    
    

    Enter your user password at the prompt.

    Type the following command to edit your hosts file:

    
    sudo vi /private/etc/hosts
    
    

    Enter your user password at the prompt.

  3. You will see a file with contents similar to the following:
    hosts
    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost
    255.255.255.255 broadcasthost
    ::1 localhost
    fe80::1%lo0 localhost
    

    Add your domain and IP address to the bottom of the file. For example:

    hosts
    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost
    255.255.255.255 broadcasthost
    ::1 localhost
    fe80::1%lo0 localhost
    70.32.88.203 example.com
    70.32.88.203 www.example.com
    

    vi tip: Press "i" to enter "insert mode" so you can type and copy/paste. Press "Esc" to exit "insert mode" when you are done modifying the file. Type ":wq" to save and quit.

  4. You may also need to grant yourself sudo priveleges, if you got a permission error in Step 2. In your "Help" menu, search for "root" and select the instructions for "Enabling the root user." Follow these.
  5. Restart any currently open browsers. You may also want to flush your DNS cache:
    
    dscacheutil -flushcache
    
    
  6. Visit your new site using http://example.com/ or http://www.example.com/

User Comments

No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article
Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue