Skip to main content
All CollectionsGetting StartedStarting With NameHero
How To Test Or Preview Your Website Before Switching DNS
How To Test Or Preview Your Website Before Switching DNS

Easily preview your website after migration.

Ryan Gray avatar
Written by Ryan Gray
Updated over a week ago

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:

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:

1. First, you need your new IP address. This can easily be found right inside your Client Area or welcome email:

Temporary IP NameHero

2. Once you have that, open Terminal inside your Utilities Folder (Applications -> Utilities -> Terminal)

3. 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

4. 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

5. 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.

6. 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.
## localhost 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.
## localhost broadcasthost
::1 localhost

7. After you add your IP + domain press Control + X to exit nano and Y and press return to commit the changes.

8. 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:

1. Locate the hosts file on your computer. Typically, for Windows 7, 8, 10 and 11 it's located in the path below:


2. 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


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.

3. 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: 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: localhost

4. When finished, Save your changes.

5. 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

6. 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!!

Did this answer your question?