How to preview a website on a new server before changing DNS: every method compared
Updated 9 min readBy the DNSPeek team
To preview a website on a new server before changing DNS, the request has to reach the new IP while still asking for your real domain. For yourself, the hosts file or curl with --resolve does that for free and shows the server exactly as visitors will see it. For phones, clients and teammates, a preview link from a service such as DNSPeek, SkipDNS, Peek-DNS or hosts.click works on any device without editing system files.
Why opening the new IP is not enough
One server usually hosts many sites and picks one by the domain name the browser sends, so http://203.0.113.10/ shows a default page or a certificate warning. Every method below sends the request to the new IP while saying “I want example.com”. They differ in who can see the result, on which devices, and how exact it is.
Method 1: edit the hosts file
Your operating system reads the hosts file before it asks DNS. One line per hostname points your domain at the new server, on this computer only:
# Windows: C:\Windows\System32\drivers\etc\hosts (edit as Administrator)
# macOS / Linux: /etc/hosts (edit with sudo)
203.0.113.10 example.com
203.0.113.10 www.example.com
# Then flush the DNS cache
ipconfig /flushdns # Windows
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder # macOS
resolvectl flush-caches # Linux with systemd-resolved- Pros: exact, free and works for anything: private IPs, every port, the new server’s own certificate and headers. The hosts file generator writes the lines for you.
- Cons: one machine at a time, needs admin rights, impractical on iOS and Android, and easy to forget. A line left behind after the migration keeps you on the wrong server.
- Best for: a developer checking their own work, and the final check of HTTPS, security headers and third-party sign-in before the switch.
Method 2: curl --resolve for a quick check
--resolve tells curl which IP to use for a hostname, so the request carries your real domain, including in the TLS handshake, and the certificate is checked:
# Status line and headers from the new server, over HTTPS
curl -sI --resolve example.com:443:203.0.113.10 https://example.com/
# The page title, to make sure it is your site and not a default page
curl -s --resolve example.com:443:203.0.113.10 https://example.com/ | grep -i "<title>"
# No certificate yet? -k skips verification; plain HTTP works with a Host header
curl -skI --resolve example.com:443:203.0.113.10 https://example.com/
curl -sI -H "Host: example.com" http://203.0.113.10/Use -H "Host: …" only for plain HTTP: over HTTPS curl would still send the IP in the TLS handshake and check the certificate against it. On Windows, type curl.exe, because in Windows PowerShell 5.1 curl is an alias for Invoke-WebRequest.
- Pros: seconds, nothing to undo, scriptable, and it shows status codes, redirects and the certificate exactly as the server sends them.
- Cons: no rendering: HTML and headers only, and only for you.
- Best for: confirming the site is set up on the new server before you spend time on anything else, and checks in scripts or CI.
Method 3: the host’s temporary URL, a staging subdomain or IP/~user
Many hosts give each account a temporary address on their own domain, and cPanel servers may serve an account at http://203.0.113.10/~username/ when the host has mod_userdir enabled. You can also add a record for a new name such as staging.example.com that points at the new server: it adds a hostname without touching the live records.
- Pros: an ordinary URL that works on any device and can be sent to anyone, with no extra service.
- Cons: the site is answering for a different hostname. WordPress and most CMSs redirect to the domain stored in their settings, which still points at the old server, and absolute links and cookies follow the real domain too. Fixing that means a search-and-replace you must reverse before launch. Many hosts disable
~userURLs, and HTTPS is on the temporary name, not on your domain. - Best for: static sites and apps that use relative URLs, or a host’s own handover when nothing else is available.
Method 4: a DNS override in the browser or on your network
Chrome and other Chromium-based browsers accept a start-up switch that maps hostnames to an IP for that browser session only. A separate profile folder makes sure a new instance starts with the rule:
# Windows (Command Prompt)
"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=%TEMP%\chrome-preview --host-resolver-rules="MAP example.com 203.0.113.10, MAP www.example.com 203.0.113.10"
# macOS
open -na "Google Chrome" --args --user-data-dir=/tmp/chrome-preview --host-resolver-rules="MAP example.com 203.0.113.10, MAP www.example.com 203.0.113.10"
# A resolver for your whole network (dnsmasq; also covers subdomains)
address=/example.com/203.0.113.10The last line is the same idea one level up: a local resolver such as dnsmasq, or a local DNS record in Pi-hole, answers with the new IP for every device that uses it, including phones on that Wi-Fi, as long as they use the network’s DNS rather than their own private DNS. Browser extensions cannot edit the hosts file; some preview services offer one as a shortcut to their links (hosts.click lists a Chrome extension; DNSPeek has none yet).
- Pros: no system files edited, nothing left behind when you close the browser, and an exact response with the real domain and certificate.
- Cons: the Chrome switch is desktop-only and easy to get wrong if Chrome is already running with the same profile. A resolver needs someone to run it, and it only helps people on your network.
- Best for: developers who want exact behaviour without touching the hosts file, and teams testing on real devices in one office.
Method 5: online preview-link services
A preview service gives you an HTTPS link on its own domain. The service connects to the IP you entered, asks for your real domain, and rewrites links, redirects and cookies so visitors stay inside the preview. It is the only method here a client can use without help.
What the services themselves state, as of October 2026 (details on DNSPeek vs SkipDNS, DNSPeek vs Peek-DNS and DNSPeek vs hosts.click):
| Item | Free option | Paid | Account | Stands out for |
|---|---|---|---|---|
| SkipDNS | Guest links only: 5 minutes or 100 clicks | $9.90 to $159.90 a month for 3 to 300 links | Not for a guest link; plans need one | cPanel plugin, REST API, running since 2016; links are deleted when a plan expires |
| Peek-DNS | Free links; each lives 7 days after its last visit | Per link: $1 password, $2 custom name, extensions to 30 or 90 days | None: there are no accounts | No sign-up at all; API planned |
| hosts.click | Free preview links | Pro $5 a month, Branded $50 a month | Not stated on its site | Chrome extension, cPanel and DirectAdmin plugins, custom domain on Branded |
| DNSPeek | Unlimited links, each lasting 7 days from the last visit, up to 30 days; one guest link without an account | From $9 a month, with non-expiring links | Not for one guest link | QA reports, live and visual compare with the live site, DNS switch alerts; no panel plugins, extension or white-label yet |
- Pros: phones, tablets and clients open it like any link, there is nothing to install or undo, and a password or expiry date keeps it under control.
- Cons: a proxy sits in the middle. DNSPeek, for example, removes
Strict-Transport-Security,Content-Security-PolicyandX-Frame-Optionsand adjusts cookie flags so the preview works on its own address; sign-in with Google and hosted payment pages return to your real domain; firewalls on the new server may challenge proxy traffic; and only public IPs can be reached. See what previews can’t do. - Best for: client and stakeholder review, mobile checks, and anyone who should not be asked to edit system files.
Every method side by side
| Item | Works on phones | Shareable with a client | HTTPS on the real domain | Needs | Cost |
|---|---|---|---|---|---|
| Hosts file | No, not without root or jailbreak | No: each person edits their own | Yes, with the new server’s certificate | Admin rights and a text editor | Free |
| curl --resolve | No | No | Yes, and the certificate is checked | curl (built into macOS, Linux and Windows 10 and later) | Free |
| Temporary URL or staging name | Yes | Yes, if the site works on another hostname | No: a different hostname | Often URL changes in the site | Included with hosting |
| Browser or network DNS override | Only with a network resolver | Only with people on your network | Yes | Chrome started with a switch, or a resolver you run | Free |
| Preview-link service | Yes | Yes: send the link | No: the service’s own HTTPS address | A browser | Free options; paid plans vary |
Which should I use?
- Solo developer, your own laptop:
curl --resolve, then the hosts file or the Chrome switch. Here they are simply the better choice: exact, free, no third party in the path. Use a preview link only for your phone. - Agency with client sign-off: a password-protected preview link. The client never touches system files; you keep the hosts file for checking HTTPS, headers and sign-in, which a proxy changes. See getting client sign-off before launch and DNSPeek for agencies.
- Hosting provider moving customers: temporary URLs break most CMSs, so send preview links, created through the API or a prefilled
/new?domain=…&ip=…link. If you need a button inside cPanel today, SkipDNS and hosts.click list panel plugins; DNSPeek does not have them yet. See DNSPeek for hosting providers.
Most migrations combine an exact check for yourself with a link for everyone else. More on that pair: hosts file vs preview link; the rest of the move: the website migration checklist.
A preview routine that works for most moves
Step 1: Get the new server’s IP
Take it from the new host’s welcome email or control panel, not from a lookup of your domain. See Find your server IP.
Step 2: Check that the server answers for your domain
Run
curl -sI --resolve example.com:443:203.0.113.10 https://example.com/. A 200 or a redirect to your own domain means the site is set up; a default page means it is not yet.Step 3: Look at it yourself in a browser
Add hosts entries with the hosts file generator or start Chrome with
--host-resolver-rules, then click through the key pages, forms and the admin area.Step 4: Share a preview link with whoever signs off
Enter the domain and IP on the new preview form, set a password if the site is sensitive, and send the link to your client or team.
Step 5: Undo your overrides after the switch
Remove the hosts lines or close the Chrome profile, then confirm public DNS has moved with the DNS propagation checker.
What to confirm, whichever method you use
Pre-switch preview
- The response comes from the new server, not a default page
- Both the bare domain and www checked
- HTTPS plan clear: certificate installed now, or issued right after the switch
- Forms, login and checkout tested with test accounts
- Mobile layout checked on a real phone
- Hosts lines, browser profiles and resolver records removed after the switch
- Preview links switched off or set to expire after launch
Frequently asked questions
What is the easiest way to preview a website before changing DNS?
For yourself on a computer, add two lines to the hosts file or run curl with --resolve: both are free and exact. For anyone else, or on a phone, create a preview link: it opens on any device with no setup.
Is there a free alternative to SkipDNS?
Yes. As of October 2026 SkipDNS offers free guest links that last 5 minutes or 100 clicks, with paid plans from $9.90 a month. Peek-DNS offers free links without an account, hosts.click lists free preview links, and DNSPeek has a free plan with unlimited links that last 7 days from the last visit, up to 30 days. The hosts file and curl are free too. Check each service’s site for current terms.
How do I preview a site on a new server from my phone?
Phones have no hosts file you can easily edit. Use a preview link, which opens like any other link, or point the phone at a local resolver on your Wi-Fi that answers with the new IP.
Can I test HTTPS on the new server before switching DNS?
Yes, with the hosts file, curl --resolve or the Chrome switch, because they use your real domain. Many hosts only issue a free certificate after DNS points at the new server, so a certificate warning before the switch is normal; check again right after it. A preview link runs on its own HTTPS address, but DNSPeek’s Verify SSL mode still checks the new server’s certificate for your domain.
Why does the temporary URL send me to my live site?
Most CMSs, WordPress included, store the site address and redirect every other hostname to it. That address still resolves to the old server, so you land on the live site. Changing it works but must be reversed before launch, so the hosts file or a preview link is usually safer.