Call us 7am - Midnight 01628 200 161My.Tsohostshopping_basket0 Item(s): £0.00
menuMenu

keyboard_backspaceBack to the Blog

How To Preview Your Website On cPanel By Editing Your Hosts File

Posted 07th May, 2013 by Dan

We understand the importance of being able to fully preview a website before going live. For cPanel customer the default 'Preview URL' tool results in multiple issues for complex sites, and sometimes images fail to load, making it increasingly difficult for users to check their site is working as expected. In this post we'll show you how to fully test the functionality of your website, simply by tweaking your hosts file.

In this tutorial you will edit the hosts file on your PC to bypass the DNS lookup and then access your site on our servers through your main domain rather than the cPanel 'Preview URL'. This only affects your PC and visitors to your website will see the site as normal.

If you have Windows on your PC

  1. Open your hosts file with Administrator permissions, to do this right click on the NotePad icon, select 'Run as Administrator'
  2. Now, in NotePad open the file: c:\windows\system32\drivers\etc\hosts

If you have Linux or Mac OSX

  1. On Mac OSX the file you need to open is /private/etc/hosts (To search go to Finder and click Go in the menu) If you have Linux the file you need to open is /etc/hosts
  2. You will probably need to use sudo to gain root privileges to edit the file
  3. Open a terminal and run sudo nano /etc/hosts

So now you've opened your hosts file, add the following line:

188.65.113.1 www.yourdomain.com yourdomain.com

Replace 188.65.113.1 with the IP address of your site, you can find this in the left hand column of cPanel. Replace "yourdomain.com" with your actual domain name.

Once you have made the change, save the file.

Now when you browse to your website as normal. You will see it served from our systems and will be able to test the full functionality of your website. To view the site on your existing host, just remove the line from your hosts file.

Note:If this doesn't work you might need to reboot your PC for the change to take effect.

Do you have any questions about editing your hosts file to preview your website? let us know in the comments below!

Categories: Tips, cPanel Hosting

You may also like:

Facebook Ad advice for small businesses and bloggers
How to choose the best colour scheme for your website
7 quick and free SEO hacks for SMBs
6 super WordPress plugins for SMBs
6 super WordPress plugins for SMBs
16 Small Business SEO Tips for 2018
16 Small Business SEO Tips for 2018
4 Of The Best Notification Plugins
4 Of The Best Notification Plugins