Reprint Relay Get started

Edit the hosts file to open your new hosting

Short answer

Add one line to your computer’s hosts file: your new hosting’s IP address, then your domain. Then only your computer opens the new hosting, until you remove the line again.

Start your move

By wp2wp.linkUpdated 4 min read

Result
Your domain opens the new hosting
Your time
About 5 minutes
Cost
Free
Your visitors
Still see the old site

Which way fits you?

Before you start

Check first: this way opens your domain with http://. For some domains, browsers refuse that. The wp2wp.link guide checks your domain and only suggests this way when it works. Otherwise use your new host’s temporary address, or ask its support for one.

Your line for the hosts file

The line is the IP address, a space, your domain, a space, and your domain with www:

203.0.113.10 your-domain.com www.your-domain.com

The IP address is your hosting’s number, four groups of digits. You find it in your new host’s control panel:

Windows 10 and 11

You edit the file in Notepad. Notepad needs administrator rights for this.

  1. In the Start menu, type Notepad.

  2. Right-click Notepad and choose Run as administrator.

    Windows asks for permission: click Yes.

  3. Choose File → Open, paste this path as the file name and click Open.

    C:\Windows\System32\drivers\etc\hosts

  4. Add your line at the very end, on its own line, and choose File → Save.

  5. In the Start menu, type cmd and open Command Prompt.

  6. Enter ipconfig /flushdns.

    This makes Windows forget the old address.

Mac

You edit the file in Terminal with the nano editor.

  1. Open Terminal in Applications → Utilities.

  2. Type sudo nano /etc/hosts and press Enter.

    Enter your Mac password. Nothing appears while you type; that’s normal.

  3. Move to the end with the arrow keys and add your line.

  4. Press Control+O and Enter to save.

    Then press Control+X to close the editor.

  5. Enter sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.

    This makes the Mac forget the old address.

Linux

You edit the file in a terminal with the nano editor.

  1. In a terminal, run sudo nano /etc/hosts.

  2. Add your line at the end.

  3. Save with Control+O and close with Control+X.

  4. Run resolvectl flush-caches.

    This works on most current systems.

Open your domain

Warning in the browser: your browser may say the connection isn’t secure. That’s expected here, so continue to the site. If the warning offers no way to continue, remove the line and use a Temporary address Many hosts give a new hosting account an extra address. With it you can open the site before your own domain points there. instead.

  1. Close your browser completely and start it again.

    Browsers keep their own memory of addresses.

  2. Type your address with http:// at the start.

    For example http://your-domain.com/reprint-web.php.

Undo it afterwards

Once your domain points to the new hosting, remove your line. Then your computer finds your site the normal way again.

  1. Open the Hosts file A small file on your own computer. It can point a domain to a server you choose, but only for your computer. the same way as before.

  2. Delete your line and save the file.

  3. Clear the cache again with the same command.

How you know it worked

If something goes wrong

I still see the old site

Check the line for typos and make sure you saved the file. Then restart the browser.

It still shows the old site, and I use a VPN

A VPN can skip the hosts file. Turn it off while you work.

Windows says I don’t have permission to save

Notepad wasn’t started as administrator. Close it, right-click Notepad, choose Run as administrator, and open the file again.

Questions

Does this change anything for my visitors?

No. The hosts file only affects the computer it’s on. Everyone else keeps seeing the old site until you switch the domain.

Does it work on my phone?

Not without extra apps. Use a computer for this.

Why does the browser warn about the certificate when I check my copied site?

That’s expected before the switch. Your new host can only create the free SSL certificate (HTTPS) What makes your site open with https:// and a lock in the browser. Most hosts create one for free once your domain points to them. once your domain points to it. Continue to the site. The warning only affects your computer.

Sources, checked 20 November 2026

Microsoft: ipconfig, Apple: reset the DNS cache, resolvectl, cPanel interface, SiteGround: hosts file, GoDaddy: preview your website, Chromium HSTS preload list.

Was this page helpful?

Back to top