Knowledgebase

How can I test my migrated website before changing the DNS?  Print this Article

You have migrated your site and need to test your site before switching the DNS.

In most cases you can test the functionality of your newly migrated site with the inbuilt 'Instant access domain alias'. however sometimes a website (mostly with WordPress Installed) can be vitally dependent on the URL being correct, if it’s not “yourdomain.com” it might not work at all.

So how can you test your site will work once the you make that DNS change? Answer, edit your local ‘hosts’ file.

 

What is a hosts file?

It’s a simple file which tells your computer where to look for specific hostnames or domain names. Mapping IP addresses to hosts/domains.

Where is it located?

Windows : C:\Windows\System32\drivers\etc\hosts

Mac : /etc/hosts

Linux: /etc/hosts

 

How do I edit the host file ?

Windows: A bit of Google looking will give you all sorts of ways to do this for various Windows versions. The way I do it is to navigate to C:\Windows\System32\drivers\etc\ and copy it into ‘My Documents‘ . Open it in Notepad, edit* and save.

*The syntax is fair straight forward, IP address followed by the domain in question:

123.123.123.123 yourdomain.com

Then I copy and paste the edited file back into the original location, confirming the overwrite of the original.

Mac/Linux: Same thing, different file location. Open /etc/hosts using your favorite editor, edit using exactly the same syntax and save.

At this point you may want to flush your DNS open a browser and navigate to your site.


Windows maintain DNS cache on the system. Next, you need to flush the DNS using Command Prompt (CMD).

ipconfig/flushdns

MacOS maintain DNS cache on the system. Next, you need to flush the DNS using the following command depending on the MacOS version,

El Capitan (10.11), Sierra (10.12), High Sierra (10.13), Mojave (10.14), and Catalina (10.15)

sudo killall -HUP mDNSResponder

 

Was this answer helpful?

Related Articles

What is cPanel?
cPanel is a fully featured web-based control panel that allows you to manage your domain through...
What is WebHost Manager (WHM)?
WebHost Manager is the control center of the cPanel/WebHost Manager package. It is used to set up...
Tools for managing MySQL databases?
Can you provide/recommend any tools for managing MySQL databases?There is a multitude of...
How to create a Redirect
Redirect feature allows for the redirection of users visiting a particular page. This can be...
Remove a Redirect
To remove an existing redirect: Click the button corresponding to the redirect you would like...

Powered by WHMCompleteSolution