• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Test Or Preview Your Website Before Switching DNS

By Ryan Gray on May 24, 2016 2

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.

Here in the office, our techs actually do this after completing a migration.  Since we use a collection of Macbooks and Mac Pros, it’s very simple to test your website before switching DNS.

If you’re using a Mac:

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

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

3. To be on the safe side, you should backup your existing host file, just incase.  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 an 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 10 / 8 / 7 it’s located:

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

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 bat 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 general public.

You can also use the cPanel preview link (i.e. http://64.91.237.213/~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!

Ryan Gray

Ryan Gray is the founder and CEO of NameHero, one of the fastest growing independent web hosts in the United States. Ryan has been working online since 1998 and has over two-decades experience in Internet Entrepreneurship.

Reader Interactions

Trackbacks

  1. How To Speed Up DNS Propagation says:
    August 17, 2017 at 5:12 pm

    […] I have a full tutorial posted up on the blog how to do this: How To Test Or Preview Your Website Before Switching DNS […]

    Reply
  2. How To Speed Up DNS Propagation – Websites Architect says:
    August 22, 2017 at 10:57 pm

    […] I have a full tutorial posted up on the blog how to do this: How To Test Or Preview Your Website Before Switching DNS […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • Caching With Query Strings – A Good Idea?
  • Why I Don’t Use Two Factor Authentication
  • Filtering Out “replytocom” Bots On WordPress
  • Five Years Straight Of 99.9% Website Uptime – NameHero
  • What Can You Do To Improve Mobile Load Times?
  • The Challenges Of Rate Limiting For Websites
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2021 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in