> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.namehero.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

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

## How to test or preview your website using cPanel:

Login to **cPanel** and click on **Website Preview** under *Domains*:

[![](https://storage.crisp.chat/users/helpdesk/website/5bb41294141d000/17b7c19e-4809-4b38-9460-eced61_bu3c3.png)](https://downloads.intercomcdn.com/i/o/897655702/5b7d1b4ae9fff20180293357/Screen+Shot+2023-11-30+at+3.32.03+PM.png?expires=1728569700&signature=6e0a36074b9e2206a42c01a4522edf4653ed77f074f1d0083a49da4cd84587f1&req=fCkgEMx7moFdFb4f3HP0gKYu97q7yUintiiAjBzFeSz5AhJvNVMBaXwLfYt0%0AtSf3AsSsd9ymk0lphg%3D%3D%0A)

Click **Create** beside the domain you wish to generate a preview link for:

[![](https://storage.crisp.chat/users/helpdesk/website/c71402965a914800/abdc085f-94a6-4641-8323-331709_1jlaikd.png)](https://downloads.intercomcdn.com/i/o/897657198/b838b6add50432f4be046e9a/Screen+Shot+2023-11-30+at+3.33.29+PM.png?expires=1728569700&signature=45cfe16a8d05a0d36f01ff518bf458ad914eff99ae9fcef836d9ddcdf8064ddd&req=fCkgEMx5nIhXFb4f3HP0gCI3rd3hzcBcGR1N1rkUEqXzV3%2F91XEWC0GAtSrF%0AEd%2BezQDZebkuQpO%2BAg%3D%3D%0A)

Click **Open** to spawn a new tab:

[![](https://storage.crisp.chat/users/helpdesk/website/44972e92a0963800/be8666a3-67c8-4b8e-a24c-f647e5_v0q0hs.png)](https://downloads.intercomcdn.com/i/o/897659536/aa2677714c8b675d0d651032/Screen+Shot+2023-11-30+at+3.37.18+PM.png?expires=1728569700&signature=2b9757bb289912539df56cf1376714313314c5b694639f39c5de79f8c1821824&req=fCkgEMx3mIJZFb4f3HP0gNfYzHpvK03K8wSblha28rhrBr5cwf6a9ROCX3T%2B%0ANYstvebzszQiDhK13w%3D%3D%0A)

Read/accept the proxy terms:

[![](https://storage.crisp.chat/users/helpdesk/website/e28b5a776f31780/bc07d69f-740f-42f2-b0b5-caea19_z4v9is.png)](https://downloads.intercomcdn.com/i/o/897660553/a8e21174dc8aa298213be30a/Screen+Shot+2023-11-30+at+3.38.17+PM.png?expires=1728569700&signature=2df79780248b052bf81620bbdbae02d14aa91fa018e6361c94677a99e0992c6e&req=fCkgEM9%2BmIRcFb4f3HP0gMEF6RJ8ykZ5BNu2F%2F6lcPUvWEBuB4VuEW1Tam5o%0AjexIEn8UbNXSidNb4Q%3D%3D%0A)

Congratulations! You can now preview your website before changing DNS:

[![](https://storage.crisp.chat/users/helpdesk/website/accb17f97d6c5800/b311ef81-455f-4c6c-af62-e85d86_1en5n24.png)](https://downloads.intercomcdn.com/i/o/897661030/bd06ca872dda43ce927c0fa4/Screen+Shot+2023-11-30+at+3.39.43+PM.png?expires=1728569700&signature=24463a5cb256e7b26679464ba9542374a6d01746e30046e7c99185ee24f04769&req=fCkgEM9%2FnYJfFb4f3HP0gO8wMXX5DMtLROlPFG9KPpWmDI5m3t2VMV%2FWniZb%0AfGqtDkvpmJsGU8M%2FwA%3D%3D%0A)

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:

[![](https://storage.crisp.chat/users/helpdesk/website/54a893a8ec13e400/b57b6409-b7f8-4318-a04b-46f782_1a23omi.png)](https://namehero.intercom-attachments-1.com/i/o/676212208/f106e127bc39e31082401980/Screenshot-2016-05-24-11.03.17.png?expires=1728569700&signature=6a5cf6f412f1cfadab7e550631c9e61976ce8f938875180b51b04d7086cf2d83&req=cichFMh8n4FXFb4f3HP0gE%2BdXRu3DjuCn5A6IPUhmnwt4sBnOhOU2xsS3SBw%0AhPvNYg5kkg%2BwhsGpqQ%3D%3D%0A)

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.`**  
​**`##`**  
​**`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

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:

**`C:\Windows\System32\drivers\etc`**

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`**

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.

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:

**`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

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](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!!