You can switch web hosts with zero downtime by following one golden rule: fully build and test your site on the new host before you point your domain at it. The safe sequence is to sign up with the new host while keeping the old one live, copy over your files, database and email, verify everything works on the new server using a temporary URL, lower your domain’s DNS TTL a day ahead, and only then update DNS. Because the old site stays online the entire time, visitors keep hitting a working site right up to the moment the switch completes — and never see an error page.
The mistake that causes downtime is cancelling the old host, or changing DNS, before the new site is confirmed working. Don’t. Overlap the two hosts for a week; the cost of a few extra days of hosting is trivial next to a broken site. Here’s the process.
Before you start: what you’ll need
Gather these so you’re not scrambling mid-migration:
- Login access to your current host (control panel / cPanel, FTP, and database).
- Your domain registrar login (this may be separate from your host — it’s where you’ll change nameservers or DNS records).
- A new hosting account — don’t cancel the old one yet. If you’re still choosing, our Best Web Hosting for Beginners 2026: The Complete Guide guide covers beginner-friendly options.
- A recent full backup of files, database and email as a safety net before you touch anything.
A quick note on terminology: your host stores your site; your registrar controls your domain’s DNS. They’re often the same company but not always. Know which is which before you begin.
Step 1: Sign up with the new host (keep the old one running)
Create your account with the new provider while your existing site stays live and untouched. Most quality hosts give you a temporary URL, a hosts-file method, or a staging domain so you can access the new server before your real domain points there. Note that temporary access down — you’ll need it to test in Step 4.
If you’re on WordPress, many hosts offer a free automated migration or a plugin (such as All-in-One WP Migration or Duplicator) that handles most of the copy for you. That can replace much of the manual work in the next two steps, but the testing and DNS discipline below still apply.
Step 2: Copy your files to the new server
Move a complete copy of your website’s files across:
- Connect to your old host via FTP/SFTP or its file manager and download everything in the site’s root (often
public_html) — or use the old host’s “generate full backup” tool. - Upload that same set of files to the equivalent folder on the new host.
- Preserve the folder structure exactly, and don’t forget hidden files like
.htaccess, which controls redirects and rewrites.
For large sites, moving a server-side backup archive and unpacking it on the new host is faster and less error-prone than transferring thousands of individual files.
Step 3: Move your database
Dynamic sites (WordPress, most CMSs, anything with logins or a shop) store content in a database that must come across too.
- On the old host, open phpMyAdmin and export the database as a
.sqlfile. - On the new host, create a fresh empty database and database user, and note the name, username and password.
- Import the
.sqlfile into that new database via phpMyAdmin. - Update your site’s config file (for WordPress,
wp-config.php) with the new database name, user, password and host so the code connects to the new database, not the old one.
This is the step people most often get wrong — if the config still points at the old database, the new site will show a connection error. Double-check those four values.
Step 4: Test everything on the new server before switching DNS
This is the step that guarantees no downtime. Using the temporary URL or hosts-file trick from Step 1, browse the new site as if it were live:
- Click through key pages, posts and products — check images, menus and forms load.
- Test dynamic features: logins, contact forms, search, and (critically) any checkout/payment flow.
- Confirm the database connection works (no “error establishing a database connection”).
- Check that redirects in
.htaccessstill fire.
Fix any problems now, while the real domain is still safely serving the old host. Only move on when the new site is genuinely working end to end.
Step 5: Lower your DNS TTL (the day before)
DNS records carry a TTL (time to live) telling the internet how long to cache them. A high TTL (say 24 hours) means some visitors could keep hitting the old server for a full day after you switch. Roughly 24 hours before you plan to change DNS, log into wherever your DNS is managed and lower the TTL on the relevant records (A record, and CNAME/nameserver records) to something short like 300 seconds (5 minutes).
Do this a day ahead because the old long TTL has to expire first for the new short value to take effect. Lowering it in advance makes the actual cutover propagate in minutes instead of hours.
Step 6: Point your domain to the new host
Now make the switch. You have two common methods — use whichever your new host recommends:
- Change nameservers (simplest): at your registrar, replace the old nameservers with the two the new host gave you. This moves all DNS to the new host at once.
- Change the A record (more surgical): point your domain’s A record at the new host’s IP address, keeping DNS managed where it is.
Because you lowered the TTL, most visitors move over within minutes, and the rest within an hour or two. Throughout, both servers hold a working copy of your site, so whichever one a visitor reaches, they see your site — not an error.
Step 7: Migrate email, then verify and decommission
Don’t forget email — if your domain hosts mailboxes, they must move too, and this is where people accidentally lose messages.
- Recreate each email account on the new host with the same addresses.
- Download or export existing mail (or use IMAP to copy it across) before the old mailboxes are deleted.
- After DNS moves, confirm you can send and receive on the new server.
Then verify the whole site once more on the live domain, watch it for several days, and only after everything is stable for about a week should you cancel the old hosting account. That overlap is your insurance policy. If the new host underwhelms, our Best Web Hosting for Beginners 2026: The Complete Guide and Hostinger Review 2026: Is Cheap Hosting Any Good? pages can help you reassess.
Troubleshooting and common mistakes
- “Error establishing a database connection”: the config file still points at the old database, or the new database credentials are wrong. Recheck the four values in Step 3.
- Mixed old/new content for a day: normal DNS propagation. It resolves faster next time if you lower TTL in advance (Step 5).
- Broken images or links: usually hardcoded old URLs in the database. A search-replace tool (or WP-CLI) can fix these; back up first.
- Lost emails: almost always caused by deleting old mailboxes before copying them. Migrate email fully before decommissioning.
- Cancelling the old host too soon: the single biggest cause of downtime. Keep both live for about a week.
FAQ
Will switching web hosts cause downtime?
Not if you overlap the two hosts. Build and fully test the site on the new host first, keep the old one live, and only change DNS once the new site works. Because both servers hold a working copy during propagation, visitors always reach a functioning site. Downtime only happens when people switch DNS or cancel the old host prematurely.
How long does a website migration take?
The file, database and email copy is often an hour or two for a small site. The variable is DNS propagation — usually minutes to a couple of hours if you lowered your TTL beforehand, but potentially up to 24-48 hours if you didn’t. Plan for a low-traffic window and keep both hosts running for about a week.
Do I need to transfer my domain name too?
No — you can keep your domain registered where it is and simply change its DNS to point at the new host. Switching hosting and transferring a domain registrar are separate actions. Many people move hosts while leaving the domain exactly where it’s registered.
What is DNS TTL and why lower it before migrating?
TTL (time to live) is how long the internet caches your DNS records. Lowering it to about 5 minutes roughly a day before you switch means the change propagates almost immediately instead of over many hours. You lower it in advance because the old, longer TTL has to expire before the new short value applies.
Can I move a WordPress site to a new host myself?
Yes. You can copy the files and database manually as described here, or use a migration plugin (Duplicator, All-in-One WP Migration) or your new host’s free migration service to automate most of it. Either way, still test on a temporary URL and manage DNS carefully before going live.
Should I keep my old hosting after switching?
Keep it for about a week after the switch, until the new site has run flawlessly on the live domain and all email has moved. That overlap lets you fall back instantly if something surfaces. Once you’re confident everything works, cancel the old account to stop paying for it.
Zen Tech Hub may earn a commission from links on this page, at no extra cost to you.