Home/cPanel guides/Preview your site

How to preview your website before pointing your domain

Moving a site to TetraHost, or building a new one? You can see it on our server before you change the nameservers by adding two lines to your computer’s hosts file. Only your computer sees the change, so visitors keep using your old host until you are ready.

5 minutesWindows, macOS and Linux

Opening the server IP address, or a link like http://IP/~username, does not show your site on TetraHost servers. That old shortcut is turned off for security. The hosts file method below is the way to preview, and it shows the site exactly as it will look on your real domain.

Step 1: find your server’s IP address

In cPanel:General Information›Shared IP Address
  1. Log in to cPanel

    See how to log in to cPanel if you need help. Until your domain points to us, use the server address from your New Account Information email.

  2. Copy the IP address

    In the General Information panel on the right, copy the Shared IP Address (or Dedicated IP Address if you have one). The same IP is in your New Account Information email.

Step 2: the two lines you will add

  1. Your IP, a space, then your domain

    Write one line for the main domain and one for www. Replace 203.0.113.10 with your own IP from step 1 and yourdomain.com with your domain:

    203.0.113.10 yourdomain.com
    203.0.113.10 www.yourdomain.com

  2. Previewing a subdomain or addon domain too?

    Add one more line for each name, for example 203.0.113.10 shop.yourdomain.com.

Step 3 on Windows 10 and 11

  1. Open Notepad as administrator

    Press the Windows key, type Notepad, right-click it and choose Run as administrator. Click Yes when Windows asks.

  2. Open the hosts file

    In Notepad click File › Open, paste C:\Windows\System32\drivers\etc\hosts into the File name box and click Open. If you can’t see the file, change Text documents (*.txt) to All files (*.*).

  3. Add the lines and save

    Go to the very end of the file, press Enter for a new line, add your two lines and press Ctrl + S. Leave the existing lines as they are.

  4. Clear the DNS cache

    Open Command Prompt and run ipconfig /flushdns.

Step 3 on macOS

  1. Open Terminal

    Press Command + Space, type Terminal and press Enter.

  2. Open the hosts file

    Run sudo nano /etc/hosts and enter your Mac password. Nothing appears while you type the password; that is normal.

  3. Add the lines and save

    Use the arrow keys to go to the end of the file, add your two lines, then press Control + O, Enter to save and Control + X to close.

  4. Clear the DNS cache

    Run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.

Step 3 on Linux

  1. Open the hosts file

    In a terminal, run sudo nano /etc/hosts and enter your password.

  2. Add the lines and save

    Add your two lines at the end, press Control + O, Enter, then Control + X. Most Linux desktops use the change straight away.

Step 4: open your site and check

  1. Restart your browser

    Close every browser window and open it again. Browsers keep their own short DNS cache.

  2. Visit your domain

    Go to http://yourdomain.com. You now see the copy on TetraHost.

  3. Not sure which server you are seeing?

    Run ping yourdomain.com in Command Prompt or Terminal. The address it shows should be your TetraHost IP. It does not matter if the replies time out; only the IP shown counts.

Step 5: remove the lines when you are done

  1. Delete the two lines

    Open the hosts file the same way, delete your lines (or put # at the start of each) and save. Then clear the DNS cache again.

  2. Why it matters

    Your computer ignores real DNS for those names while the lines are there. Remove them once your domain points to TetraHost, so you don’t keep seeing an old address later.

Tips and common problems

  • Security warning on https://? Free SSL is issued only after your domain points to us (see free SSL), so until then the browser warns that the certificate doesn’t match. Use http://, or continue past the warning on your own computer for this preview. If the site jumps to https by itself, try another browser.
  • Still seeing the old site? Turn off any VPN, proxy or proxy browser extension while you test; they look up the domain themselves and ignore your hosts file. Then clear the DNS cache and restart the browser again.
  • “Access denied” when saving on Windows? Notepad wasn’t opened as administrator. Close it and start again with Run as administrator.
  • The file saved as hosts.txt? The hosts file has no extension. Delete hosts.txt and save again with All files (*.*) selected.
  • Antivirus blocked the change? Some security software protects the hosts file. Allow the change, or pause the protection while you edit it.
  • Ready to go live? Follow how to point your domain to TetraHost, then remove your hosts lines.

Questions

Can I view my site with the server IP or a ~username link?

No. On TetraHost servers the IP/~username shortcut (mod_userdir) is turned off for security, and the bare IP shows the server’s default page. Use the hosts file method instead; it shows your site exactly as it will look on your domain.

Will visitors see the new site after I edit my hosts file?

No. The change only affects your own computer. Visitors and email keep using the old host until you change the nameservers or A record.

Does this work for a subdomain or an addon domain?

Yes. Add one line for each name you want to preview, for example your server IP followed by shop.yourdomain.com.

Can I do this on my phone?

Not without rooting or jailbreaking it, because Android and iPhone do not let you edit the hosts file. Use a Windows, Mac or Linux computer.

See plans & pricing