How To Test Or Preview Your Website Before Switching DNS
One of the most common questions we get is, "How Do I Preview My Website Before Changing My Name Servers?"
Since we offer free migrations from other web hosts, a lot of our customers want to double-check everything before going live just to ensure there is no downtime and visitors don't even realize a migration has happened.
In order to make this process simple, we've added a new tool inside of cPanel that enables you to easily test your website before changing your DNS:
Login to cPanel and click on Website Preview under Domains:
Click Create beside the domain you wish to generate a preview link for:
Click Open to spawn a new tab:
Read/accept the proxy terms:
Congratulations! You can now preview your website before changing DNS:
For those wishing to modify their localhost file on a Mac or Windows machine, you can easily do that by following these instructions:
First, you need your new IP address. This can easily be found right inside your Client Area or welcome email:
Once you have that, open Terminal inside your Utilities Folder (Applications -> Utilities -> Terminal)
To be on the safe side, you should backup your existing host file, just in case. Simply copy/paste the following command and hit return:
`sudo cp /private/etc/hosts /private/etc/hosts-orig`
After you have a backup copy, you can then edit your host file. To get started, simply copy/paste the following command and hit return:
`sudo nano /private/etc/hosts`
You will then be prompted your admin password for your Mac user. Enter it just like you're logging onto your computer and press return.
This will bring up your host file which looks something like this:
`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`**
Below this, you will add your domain and IP address. For example:
`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`**
**`64.91.237.213 yourcooldomain.com`**
`64.91.237.213 www.yourcooldomain.com`
After you add your IP + domain press Control + X to exit nano and Y and press return to commit the changes.
Once this has been completed, you need to flush your local DNS by typing this command and pressing return:
`dscacheutil -flushcache`
After you do that, close out your open browsers, and re-open to view your website on the new server! Sometimes, just to double-check, I'll upload a unique file to the new server and make sure I can access it in my browser.
Locate the hosts file on your computer. Typically, for Windows 7, 8, 10 and 11 it's located in the path below:
`C:\Windows\System32\drivers\etc`
Right-click on it and select Notepad.
But sometimes, even when you are logged on with administrative credentials, you may receive the following error message:
`Access to C:\Windows\System32\drivers\etc\ hosts was denied`
Or
`Cannot create the C:\Windows\System32\drivers\etc\hosts file. Make sure that the path and file name are correct.`
In this case, type Notepad in start search and right-click on the Notepad result. Select Run as administrator.
Once you get it opened you can start making changes. As with our Mac instructions you may wish to copy your original file just in case.
By default, a Windows hosts file should be similar to the following:
`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 (see screenshot in step 1 of Mac). Example:
`127.0.0.1 localhost`
**`64.91.237.213 yourcooldomain.com`**
`64.91.237.213 www.yourcooldomain.com`
When finished, Save your changes.
You then want to flush your DNS cache by typing in cmd and the Windows search box will appear on the right side. Right-click on Command Prompt and click Run as administrator. Type in: `ipconfig /flushdns`
Restart any open browsers and then visit your website in the browser of your choice!
Both of these solutions are very quick and efficient and allow you to 100% preview your website on your new server prior to changing your DNS and going live to the public.
You can also use the cPanel preview link (i.e. http://x.x.x.x/~USERNAME**)** but if you have hard-coded your domain on any images or links you may not get an accurate preview. This is especially the case when using WordPress.
If you have any questions or concerns, feel free to let us know, we'd be happy to help!!
Since we offer free migrations from other web hosts, a lot of our customers want to double-check everything before going live just to ensure there is no downtime and visitors don't even realize a migration has happened.
In order to make this process simple, we've added a new tool inside of cPanel that enables you to easily test your website before changing your DNS:
How to test or preview your website using cPanel:
Login to cPanel and click on Website Preview under Domains:
Click Create beside the domain you wish to generate a preview link for:
Click Open to spawn a new tab:
Read/accept the proxy terms:
Congratulations! You can now preview your website before changing DNS:
For those wishing to modify their localhost file on a Mac or Windows machine, you can easily do that by following these instructions:
**If you're using a Mac:**
First, you need your new IP address. This can easily be found right inside your Client Area or welcome email:
Once you have that, open Terminal inside your Utilities Folder (Applications -> Utilities -> Terminal)
To be on the safe side, you should backup your existing host file, just in case. Simply copy/paste the following command and hit return:
`sudo cp /private/etc/hosts /private/etc/hosts-orig`
After you have a backup copy, you can then edit your host file. To get started, simply copy/paste the following command and hit return:
`sudo nano /private/etc/hosts`
You will then be prompted your admin password for your Mac user. Enter it just like you're logging onto your computer and press return.
This will bring up your host file which looks something like this:
`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`**
Below this, you will add your domain and IP address. For example:
`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`**
**`64.91.237.213 yourcooldomain.com`**
`64.91.237.213 www.yourcooldomain.com`
After you add your IP + domain press Control + X to exit nano and Y and press return to commit the changes.
Once this has been completed, you need to flush your local DNS by typing this command and pressing return:
`dscacheutil -flushcache`
After you do that, close out your open browsers, and re-open to view your website on the new server! Sometimes, just to double-check, I'll upload a unique file to the new server and make sure I can access it in my browser.
**If you're using Windows:**
Locate the hosts file on your computer. Typically, for Windows 7, 8, 10 and 11 it's located in the path below:
`C:\Windows\System32\drivers\etc`
Right-click on it and select Notepad.
But sometimes, even when you are logged on with administrative credentials, you may receive the following error message:
`Access to C:\Windows\System32\drivers\etc\ hosts was denied`
Or
`Cannot create the C:\Windows\System32\drivers\etc\hosts file. Make sure that the path and file name are correct.`
In this case, type Notepad in start search and right-click on the Notepad result. Select Run as administrator.
Once you get it opened you can start making changes. As with our Mac instructions you may wish to copy your original file just in case.
By default, a Windows hosts file should be similar to the following:
`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 (see screenshot in step 1 of Mac). Example:
`127.0.0.1 localhost`
**`64.91.237.213 yourcooldomain.com`**
`64.91.237.213 www.yourcooldomain.com`
When finished, Save your changes.
You then want to flush your DNS cache by typing in cmd and the Windows search box will appear on the right side. Right-click on Command Prompt and click Run as administrator. Type in: `ipconfig /flushdns`
Restart any open browsers and then visit your website in the browser of your choice!
Both of these solutions are very quick and efficient and allow you to 100% preview your website on your new server prior to changing your DNS and going live to the public.
You can also use the cPanel preview link (i.e. http://x.x.x.x/~USERNAME**)** but if you have hard-coded your domain on any images or links you may not get an accurate preview. This is especially the case when using WordPress.
If you have any questions or concerns, feel free to let us know, we'd be happy to help!!
Updated on: 11/10/2024
Thank you!