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
- 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.
- 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
- Your IP, a space, then your domain
Write one line for the main domain and one for
www. Replace203.0.113.10with your own IP from step 1 andyourdomain.comwith your domain:203.0.113.10 yourdomain.com203.0.113.10 www.yourdomain.com - 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
- Open Notepad as administrator
Press the Windows key, type Notepad, right-click it and choose Run as administrator. Click Yes when Windows asks.
- Open the hosts file
In Notepad click File › Open, paste
C:\Windows\System32\drivers\etc\hostsinto the File name box and click Open. If you can’t see the file, change Text documents (*.txt) to All files (*.*). - 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.
- Clear the DNS cache
Open Command Prompt and run
ipconfig /flushdns.
Step 3 on macOS
- Open Terminal
Press Command + Space, type Terminal and press Enter.
- Open the hosts file
Run
sudo nano /etc/hostsand enter your Mac password. Nothing appears while you type the password; that is normal. - 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.
- Clear the DNS cache
Run
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.
Step 3 on Linux
- Open the hosts file
In a terminal, run
sudo nano /etc/hostsand enter your password. - 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
- Restart your browser
Close every browser window and open it again. Browsers keep their own short DNS cache.
- Visit your domain
Go to
http://yourdomain.com. You now see the copy on TetraHost. - Not sure which server you are seeing?
Run
ping yourdomain.comin 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
- 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. - 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.txtand 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.