How to Migrate a Website to a New Host
A website migration is the process of copying a site's files, database and (often) email to a new hosting provider, then repointing the domain's DNS to the new server. Downtime is avoidable in most cases by setting up and testing the site on the new host first, lowering the DNS TTL in advance, and only switching once everything checks out.
What a migration actually moves
- Files: HTML, CSS, JavaScript, images and application code.
- Database: the content behind CMS platforms such as WordPress, including posts, settings and user accounts.
- Email: mailboxes, if the new host will also handle email, which is a separate step from the website itself.
- DNS records: the A, AAAA, MX and other records that tell the internet where your domain's traffic should go.
- SSL certificate: usually reissued automatically on the new server once DNS points to it.
Step-by-step migration process
- Back up everything on the current host: files, database and email, before touching anything.
- Set up the new hosting account and copy the files and database to it.
- Test the site on the new host using its temporary URL, or by editing your computer's hosts file so only you see the new copy, before any public DNS change.
- Lower the DNS TTL (time to live) on your current DNS records to a short value, such as 300 seconds, a day or two beforehand, so the eventual switch propagates quickly.
- Update DNS to point to the new host once testing passes.
- Keep the old hosting account active for a few days while DNS propagates worldwide, so any visitor still reaching the old server gets a working site.
- Verify the live site, forms, SSL and email on the new host, then cancel the old account.
Avoiding downtime during the switch
The main risk is not the migration itself but the DNS propagation window, during which different visitors may briefly see either the old or the new server depending on their internet provider's cache. Keeping the old site running and unchanged during that window, rather than deleting it right away, means nobody sees a broken page either way. You can preview the new server before the public switch by editing your local hosts file:
# Add a line to your computer's hosts file to preview the new server
# (Linux/macOS: /etc/hosts, Windows: C:\Windows\System32\drivers\etc\hosts)
203.0.113.10 example.com
# Check how far DNS has propagated
dig +short example.com A
Common migration mistakes
- Forgetting to migrate email separately, which can cause missed messages if it is hosted apart from the website.
- Leaving the old site's URL hardcoded in the database, which keeps assets or links pointing at the old host.
- Not reissuing or waiting on the SSL certificate on the new server, causing certificate warnings.
- Missing scheduled tasks (cron jobs) that ran on the old server but were never recreated on the new one.
- Changing DNS before testing, instead of after.
Frequently asked questions
How long does a website migration take?
The copy and setup work often takes a few hours for a small site, but allow one to three days total so DNS can propagate fully before you cancel the old hosting account.
Will my website go down during migration?
It does not have to. Setting up and testing the new host before switching DNS, and keeping the old host running during propagation, lets most migrations happen with no visible downtime.
Does changing hosts affect my domain name?
No, your domain registration stays separate from hosting. You only need to update the DNS records so the domain points to the new server, not transfer the domain itself.
Can I migrate a WordPress site myself?
Yes. Many hosts and plugins offer one-click or guided WordPress migration that copies files and the database, though checking the site afterward for broken links or plugin issues is still worthwhile.
What is DNS propagation and how long does it take?
DNS propagation is the time it takes for updated DNS records to reach every resolver on the internet. It typically completes within a few hours and often finishes faster if the TTL was lowered beforehand.
Do I need to update my email when migrating hosts?
Only if your email is hosted on the same server as your website. If so, mailboxes and their MX records need to move too, ideally planned alongside the website switch to avoid missed mail.
Related topics
- What Is a Hosting Provider? Hosting Basics
- What Is DNS (Domain Name System)? Domains & DNS
- What Is an SSL Certificate? Security & SSL
- What Is a Hosting Account? Hosting Basics
- What Is Web Hosting? Hosting Basics