WHAT'S NEW
Web Hosting & Server Basics · GuideGuides › Web Hosting & Server Basics

Migrating a Site to a New Host

Move a website between hosts with no lost data and almost no downtime: back up, copy, test privately, then switch your domain.

📶 Intermediate⏱ 12 min🗓 Updated November 17, 2026❤ 0
migrate.txt
// Safe move order
1. back up everything
2. copy site to new host
3. test before switching
4. point the domain
5. keep old host 1-2 weeks
// Before you start

🧰 What you need first

  • Access to both hosting accounts
  • Access to your domain's DNS or nameservers
  • A recent full backup

🎯 What you'll learn

  • Copy files and the database to a new host
  • Test the new copy before visitors see it
  • Switch over with almost no downtime

🛠 Tools needed

  • Both control panels
  • A migration plugin (for WordPress) or SFTP
  • Your registrar account
01 / Start here

The plan

A website is two things: files and usually a database. Moving hosts means copying both, checking the copy works, then pointing your domain at the new place.

Tip: Many hosts migrate your site for free. Ask your new host before doing it yourself.

02 / Before you start

Prepare

  • Take a full backup of files and database at your old host, and download it
  • Write down your email settings and DNS records, especially MX and TXT
  • A day ahead, lower your DNS records' TTL to 300 seconds so the switch spreads faster
  • Don't cancel your old hosting yet
03 / Option A

WordPress: use a migration plugin

Migration plugins pack up your whole site and unpack it on the new host. A few popular ones, in alphabetical order:

  • All-in-One WP Migration
  • Duplicator
  • Migrate Guru

mC0de isn't paid by any of them. Free versions may limit the size of a site you can move.

  1. Install a fresh WordPress at your new host (most hosts have a one-click installer).
  2. Install the same migration plugin on both sites.
  3. Export from the old site and import into the new one.
  4. Log in to the new site with your old username and password.
04 / Option B

Any site: move it by hand

  1. Download all your site files with SFTP or a Backup tool.
  2. Export the database with phpMyAdmin (Export → SQL).
  3. At the new host, create a new database and user.
  4. Upload the files and import the database.
  5. Update the site's config file (for WordPress, wp-config.php) with the new database name, user and password.
05 / Step 3

Test before switching

Your domain still points at the old host, so you need another way to preview the new copy:

  • Use your new host's temporary URL or preview link, if it has one.
  • Or edit your computer's hosts file to point your domain at the new server's IP, just for you.
  • Pages, images and menus load
  • You can log in and save changes
  • Forms and checkout work
06 / Step 4

Switch the domain

Change your nameservers or A records to the new host. Visitors move over gradually as DNS spreads, usually within a few hours.

Warning: If you switch nameservers, recreate your email (MX) records at the new host first, or your email can stop arriving.

07 / Step 5

Finish up

  • Run SSL at the new host once the domain points there
  • Avoid edits on the old site during the switch, or they'll be lost
  • Keep the old host for 1–2 weeks, then cancel
08 / Help

Common problems

"Error establishing a database connection"

Why: The database details in the config file don't match the new host.
Fix: Check the database name, user, password and host in wp-config.php.

Images and links still go to the old address

Why: Old URLs are stored in the database.
Fix: Use a search-and-replace tool to update them. Back up first.

Email stopped after the move

Why: MX records weren't copied before switching nameservers.
Fix: Add your email provider's MX records at the new DNS host.

// Recap

Key takeaways

Back up before anything else
Ask your new host about free migration first
Test the new copy before you change DNS
Copy your email records before switching nameservers
Keep the old host active for a week or two
// What's next

Keep going

Enjoyed this guide?

Support free learning at mC0de.

PIX0
</> {} JS 01
0101 </> CSS JS HTML PIX0 const {} 1010 async mC0de function return 0101 <div> 1010 PIX0 CSS JS HTML const {} 0101 mC0de
PIX0 // WORLD OF CODE
PIX0 IS PREPARING SOMETHING AWESOME FOR YOU 0%