How to test your website after migration

A common question, usually just after a person has migrated their website data from one server to another is, “How can I test my sites to see if the migration was successful?” Ah, an excellent question and I’m glad you asked! It is extremely important to test the functionality of your site before changing the DNS to point to the new server.

There are two common methods, use a temporary URL or edit your hosts file. While I will discuss both, I am only recommending the first, that is, change your hosts file.

 

How to edit your hosts file

The one sure way to verify your migration was successful, is to change your hosts file. This can be performed on Windows, Linux and Macs. This method tells your browser to ignore the publicly available DNS and to use a specific IP that you designate. By using this method, your javascript, css and all other aspects of your site are served from the correct server and everything should perform as expected.

Notice!

When editing your hosts file, you must use fully qualified domain names. i.e. www.domain.com
Wild card characters (‘*’) are NOT allowed!

Windows Server 2008, Windows 7 and lower

Click to view Windows Instructions
 
Open File explorer by right-clicking on Start then select “Open Windows Explorer”

hosts-1

 
Inside Windows Explorer, navigate to the following folder:
Computer > Local Disk (C:) > Windows > System32 > drivers > etc

hosts-2

 
Right click “hosts” and select “Open”

hosts-3

 
If prompted, select Notepad then click OK. Notepad should be the default, so do not be alarmed if this step is not required and you can skip to the next step.

hosts-4

 
Scroll to the bottom of the file and add a line similar to the line displayed.

Replace “IP.ADD.RE.SS” with the IP address you moved the site to
Replace “mydomain.com” with the actual domain name

hosts-6

 
Save the file and close Notepad. File > Save

hosts-7

 
Finally, completely close all instances of your browser and reopen it. You should now be able to enter you domain name in the address bar and view the site at its new location.

 

Linux

Click to view Linux Instructions
Open a terminal, then open your hosts file with the editor of your choosing. I prefer Nano.

sudo /etc/hosts

Add a line at the bottom of the file similar to the example below.

Replace “IP.ADD.RE.SS” with the IP address you moved the site to
Replace “mydomain.com” with the actual domain name
IP.ADD.RE.SS mydomain.com www.mydomain.com

Save the file and close it. If you are using Nano, use Ctrl+o to save and Ctrl+x to exit.

 

Mac OS X

Click to view Mac Instructions
Open a terminal, then open your hosts file.

nano /private/etc/hosts

Add a line at the bottom of the file similar to the example below.

Replace “IP.ADD.RE.SS” with the IP address you moved the site to
Replace “mydomain.com” with the actual domain name
IP.ADD.RE.SS mydomain.com www.mydomain.com

Save the file and close it. Use Ctrl+o to save and Ctrl+x to exit.

 

Temporary URLs

The use of temporary URLs is not recommended do to inherent flaws with the technique. Instead use the method provided below under “Edit hosts file”

Temporary URLs are often made available when using a control panel such as Plesk or WHM/cPanel, with each using a different method. While temporary URLs allow you to access your files via a browswer, they do nothing to help with any hardcoded links in your site that link back to the website’s domain name. Because of this, you might find that often the javascript or css files do not load and the site does not perform correctly. This method also often fails when using PHP sessions.

Plesk

click to view Plesk instructions

Plesk Version 10 or higher

Replace “IP.ADD.RE.SS” with the IP address you moved the site to
Replace “mydomain.com” with the actual domain name

https://IP.ADD.RE.SS:8443/sitepreview/http/mydomain.com/

Plesk Versions 8 though 9

Replace “IP.ADD.RE.SS” with the IP address you moved the site to
Replace “mydomain.com” with the actual domain name

http://IP.ADD.RE.SS/$sitepreview/mydomain.com/

Plesk Subdomains

Plesk Temporary URLs do not work with subdomains, such as blog.mydomain.com. To view a subdomain, see the section “Edit Hosts File”

WHM / cPanel

Click to view WHM / cPanel instructions
Replace “IP.ADD.RE.SS” with the IP address you moved the site to
Replace cpanelUserName with the cPanel username you assigned in WHM

http::IP.ADD.RE.SS/~cpanelUserName/
or
https::IP.ADD.RE.SS/~cpanelUserName/

Comments

So empty here ... leave a comment!

Leave a Reply

Sidebar