Knowledgebase: Migration
HOW TO: Preview/Test Website Before Switching DNS or After Migration
Posted by Shakir M. on 20 September 2019 12:25 PM

Overview

There are a few different ways to preview your site before DNS resolves it. Or after you upload your website files and database to your hosting.

 

Using Plesk's built-in preview features

Plesk comes with a built-in preview features that you may use to see your site before the domain is pointed through DNS. To use Plesk's preview feature, use the following steps.

  • Log in to Plesk.
  • Click on Websites & Domains
  • Click Preview under the domain that you wish to preview.

 

 

 

 

Previewing your site with cPanel

To preview your site with cPanel, you only need to use the IP of the server, which you can find in your cpanel, and the username of the cPanel account the domain is on.

 

Finding your IP

  1. Log in to the Cpanel.
  2. Get your hosting IP address.

 

Loading your site in the browser

Once you have your IP, you can simply use the following in your browser's address bar.

http://101.99.77.100/~cpanelusername

 

An example: http://101.99.77.100/~centcloud

 

In the example above, you would replace "101.99.77.100" with the IP of your hosting server and "username" with the username of your cpanel account.

 

 

Preview doesn't load

If your site preview does not load, then you may need to log into WHM if you are a VPS or Dedicated Server and check Apache mod_userdir Tweak to ensure mod_userdir is enabled for your domain.

 

 

If your site uses PHP and the preview is prompting a "Not Supported" message, then you may also need to update the PHP handler (for example from CGI to SuPHP). To change a PHP handler:

 

1. Log into WHM.

2. Navigate to EasyApache.

3. Select Customize next to your package.

 

 

4. Navigate to Apache Modules and enable mod_suphp.

(tip: you can use the search bar to help locate the module)

 

5. Click on Review.

6. Then scroll to the bottom of the Review page and select Provision to save your changes.

 

7. While still in WHM, navigate to MultiPHP Manager.

 

8. Click on PHP Handlers.

9. Locate your desired PHP version and select Edit to select the desired handler.

 

 

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/Win8/Win10, and Apple's Mac OS X.

 

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

 

READ ME

Shinjiru 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 OS

  1. Locate the HOSTS file on your computer. Typically it is in one of the following locations:
    • Windows NT/2000/XP/2003/Vista/Win8/Win10 - 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 hostnames. By default, a windows hosts file should be similar to the following:

Filename: 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:

Filename: hosts

127.0.0.1 localhost

101.99.77.100 50centcloud.com

101.99.77.100 www.50centcloud.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:

Filename: 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:

Filename: 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

101.99.77.100 50centcloud.com

101.99.77.100 www.50centcloud.com

 

vi command 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 privileges 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/

 

Feel free to contact us if you require any further assistance on previewing your website without switching the DNS. Email at [email protected]  or Submit a support ticket on https://247livesupport.biz .

 

 

(1 vote(s))
Helpful
Not helpful

Comments (0)
Copyright © 1998 - 2021 Shinjiru International Inc. All Rights Reserved.