Avatar Website Design

How to Migrate a Website to a New Host (Step-by-Step)

How to Migrate a Website to a New Host (Step-by-Step)

Switching hosting providers can feel like performing surgery on your business, one wrong move and your site could go dark. But knowing how to migrate a website to a new host doesn’t require a computer science degree. It does require a clear plan, careful execution, and attention to a few critical details that most guides gloss over.

Maybe your current host is slow, unreliable, or just too expensive. Whatever the reason, migrating your website is sometimes the best decision you can make for your online presence. The problem is that a botched migration can mean lost files, broken links, and tanked search rankings, exactly the kind of headaches small business owners don’t have time for.

At Avatar Website Design, we handle website migrations for small businesses regularly as part of our web design and maintenance services. We’ve seen what goes wrong (and why), so we put together this step-by-step guide based on real experience. Below, you’ll find the exact process to move your site, files, databases, emails, domain settings, and all, to a new host without losing data or damaging your SEO.

Before you start: what to gather and decide

Jumping into a website migration without the right information in front of you is how things break. Before you touch a single file, gather your credentials, understand your site’s setup, and make a few key decisions upfront. Spending 30 minutes on this preparation stage will save you hours of troubleshooting mid-migration.

Collect your login credentials and access details

You need access to three places: your current hosting account, your domain registrar, and your new hosting account. These are often separate companies, so track them all down before you start. Write them down or save them in a password manager:

  • Current host control panel login (cPanel, Plesk, or similar)
  • FTP or SFTP credentials for direct file access
  • Database name, username, and password (usually found in your host’s database manager or your site’s config file)
  • Domain registrar login (where you purchased your domain, such as GoDaddy or Google Domains)
  • Current DNS records (screenshot or export these before making any changes)

Missing even one of these before you start can halt your migration mid-process and leave your site in a broken, inaccessible state.

Know exactly what your site is built on

Your site’s technology stack determines the migration steps you’ll follow. A WordPress site moves differently than a static HTML site or a custom PHP application. Before you figure out how to migrate a website to a new host, confirm what you’re actually working with.

Log into your current hosting control panel and note the following:

  • CMS or framework: WordPress, Joomla, Drupal, or custom HTML
  • PHP version your site currently runs on
  • Database type: Most sites use MySQL or MariaDB
  • Email hosting: If your email runs through your current host, plan to migrate that separately
  • SSL certificate type: Free via Let’s Encrypt, or a paid certificate tied to your current provider

Decide on your new hosting environment

Choosing the right hosting plan before migration prevents the frustration of discovering your site doesn’t fit the environment after you’ve already started moving files. Shared hosting works fine for most small business websites, but if your current site is sluggish due to resource limits, a VPS or managed hosting plan is worth considering.

Your new host should support the same PHP version and database type your site currently uses. Contact the new host’s support team and confirm this before you sign up. Also verify whether the new host includes free SSL certificates through Let’s Encrypt, since you’ll need to set up SSL after the migration is complete. Sorting this out now means no surprises when you’re almost finished.

Step 1. Plan the move and reduce downtime risks

Good planning is the difference between a migration that wraps up in a few hours and one that costs you a full day of visibility. Before you touch a single file, map out your entire migration timeline and identify the biggest risk points. For most small business websites, the highest risk moment is the DNS cutover, since that’s when your domain points to the new server and propagation takes time.

Choose a low-traffic window for the migration

Your site will experience a brief period of instability during and right after the DNS switch, so you want to time the cutover when the fewest visitors are on your site. Pull up your Google Analytics or your hosting stats and identify your lowest-traffic day and hour, typically a Tuesday or Wednesday night between 11 PM and 2 AM in your local time zone. Scheduling the DNS change then reduces how many users hit a broken or unreachable page.

Plan to keep the migration window to under four hours if possible, and notify any staff or clients who depend on your site before you begin.

Build a simple migration checklist

Knowing how to migrate a website to a new host is easier when you’re working from a written plan rather than from memory. Use this checklist to track each phase:

Task Status
Collect all credentials and access details [ ]
Back up files and database [ ]
Set up new hosting account and database [ ]
Transfer files via FTP or file manager [ ]
Import and update the database [ ]
Update config files and internal URLs [ ]
Test the site using a temporary URL [ ]
Update DNS records and monitor propagation [ ]

Working through this task by task prevents you from skipping a step under pressure. Print it out or keep it open in a browser tab throughout the migration.

Step 2. Back up site files, databases, and email

Before you transfer anything, create a complete backup of your current site. This is your safety net. If something breaks during the migration, a full backup means you can restore everything and start over without permanent damage. Skipping this step is the most common reason website migrations turn into disasters, so treat it as non-negotiable no matter how straightforward your site looks.

Never begin a migration without a verified backup stored somewhere outside your current host, such as your local computer or cloud storage.

Back up your site files via FTP

Connect to your current server using an FTP client like FileZilla with the SFTP credentials you gathered in the preparation stage. Navigate to your site’s root directory (usually public_html or www) and download the entire folder to your local machine. This includes your theme files, plugins, uploaded media, and any custom scripts. The download may take time depending on your site’s size, so start this before any other step and let it run.

Back up your site files via FTP

Export your database

Most sites store their content, settings, and user data in a MySQL or MariaDB database, separate from the files you just downloaded. Log into your current host’s control panel, open phpMyAdmin, select your database, and click Export. Use the "Quick" export method with SQL format for a standard WordPress or PHP-based site. Save the .sql file to the same local folder where you saved your site files. Here is what a basic export command looks like if you prefer the terminal:

mysqldump -u your_db_user -p your_database_name > site_backup.sql

Back up your email accounts

If your email accounts are hosted on your current provider, you need to export those separately before migrating. Use your email client (such as Outlook or Thunderbird) to export each inbox to a local .pst or mbox file. Check whether your new host supports email migration tools or manual IMAP import, since that determines how you’ll restore your messages after the move.

Step 3. Set up the new host and create the database

Once your backup is safe and stored locally, log into your new hosting account and get the server environment ready before you move a single file. This step ensures your new server can actually run your site, and skipping it is a fast way to end up with a broken installation after the transfer.

Create your hosting account and configure the environment

Your new host’s control panel, usually cPanel or Plesk, is where you’ll spend most of your time during this step. Log in and confirm that your PHP version matches what your current site requires, since a mismatch will break PHP-based sites like WordPress immediately. Most control panels let you set the PHP version per domain under a section labeled "PHP Manager" or "MultiPHP."

Setting the correct PHP version before importing any files prevents hard-to-diagnose errors that only appear after the full migration is complete.

If your current site runs on PHP 8.1, make sure the new server matches that version exactly. Contact your new host’s support team if you don’t see the option to select a PHP version in the control panel.

Create the database and user on the new server

Every WordPress or database-driven site needs a fresh database on the new host before you can import your data. In cPanel, navigate to "MySQL Databases," create a new database, create a new database user, and then assign that user to the database with all privileges. Write down the exact database name, username, and password you create here, since you’ll need those details in the next step to update your site’s configuration file.

Create the database and user on the new server

Here is what the privilege grant looks like in SQL if you prefer the command line:

GRANT ALL PRIVILEGES ON new_database_name.* TO 'new_db_user'@'localhost';
FLUSH PRIVILEGES;

Understanding how to migrate a website to a new host means recognizing that your new database credentials will differ from the old ones, even if you use identical names. Keep that information written down and accessible before you move forward.

Step 4. Transfer files and import the database

With your new server configured and your database ready, you can now move your site files and database content to the new host. This step is where the actual migration happens. Work through the file transfer first, then handle the database import so both pieces are in place before you update any configuration settings.

Upload your site files to the new server

Open FileZilla and connect to your new server using SFTP credentials from your new hosting account. Navigate to the root directory, typically public_html, and upload everything from the local backup folder you downloaded in Step 2. Keep the folder structure identical to what it was on the old server, since WordPress and most CMS platforms depend on specific file paths to function correctly.

Large sites with many media uploads can take an hour or more to transfer, so start the upload and avoid interrupting the connection partway through.

If your site is large, the command line option below is faster than a GUI client:

scp -r /local/path/to/site/ user@newserver:/public_html/

Import the database to the new host

Log into your new host’s cPanel and open phpMyAdmin. Select the new database you created in Step 3, click the Import tab, and upload the .sql file from your local backup. For most small business websites, this import completes in under a minute. If phpMyAdmin times out due to file size, use the command line instead:

mysql -u new_db_user -p new_database_name < site_backup.sql

Knowing how to migrate a website to a new host means understanding that your imported database still contains references to your old server’s URLs and file paths. You will fix those in the next step, so do not open your site yet and expect it to look correct. Confirm that phpMyAdmin shows your tables loaded without errors before moving on, since a partial import will cause your site to load broken pages or return database connection errors.

Step 5. Update configs, URLs, and SSL settings

Your files and database are now on the new server, but your site configuration still points to your old host’s database credentials. This step corrects those references so your site connects to its data on the new server rather than failing silently. You also need to replace hardcoded URLs throughout the database and activate SSL, since both affect whether your site loads correctly after the DNS switch.

Update your WordPress config file

Open your wp-config.php file in a text editor and update the database connection values to match the credentials you created in Step 3:

define( 'DB_NAME', 'new_database_name' );
define( 'DB_USER', 'new_db_user' );
define( 'DB_PASSWORD', 'your_new_password' );
define( 'DB_HOST', 'localhost' );

Save the file and re-upload it to your public_html directory via SFTP, replacing the version you transferred in Step 4. If your site is not WordPress, find the equivalent configuration file such as config.php or .env and update the database connection details there using the same logic.

Replace old URLs in the database

Your imported database contains hardcoded references to your old domain and server paths. These will break internal links and images if you leave them untouched. Run this SQL query in phpMyAdmin to correct the two most critical URL fields in WordPress:

UPDATE wp_options SET option_value = REPLACE(option_value, 'http://oldsite.com', 'https://newsite.com') WHERE option_name = 'siteurl' OR option_name = 'home';

Run this before testing your site, because mismatched URLs are one of the most common reasons a migrated site loads without styles or returns broken images.

For a thorough replacement across all tables, use a full search-replace SQL script or run one through phpMyAdmin directly on each table that stores URLs.

Activate SSL on the new host

Understanding how to migrate a website to a new host means recognizing that your SSL certificate does not transfer automatically from the old server. Log into your new host’s control panel and install a free Let’s Encrypt certificate through the SSL section. Once installed, force HTTPS site-wide by adding this redirect rule to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Step 6. Test the site on the new server before DNS

Do not flip your DNS until you have visually confirmed your site works on the new server. Testing before the DNS switch is one of the most important parts of understanding how to migrate a website to a new host, because it lets you catch broken pages, missing styles, or database errors before any real visitor sees them. You do this by temporarily forcing your local computer to resolve your domain to the new server’s IP address, without changing anything publicly.

Preview the site using your hosts file

Your operating system has a local hosts file that overrides public DNS for your machine only. By adding a temporary entry pointing your domain to the new server’s IP, your browser will load the site from the new host while the rest of the world still sees the old one. Find your new server’s IP address in your hosting control panel, then edit the hosts file:

On Mac or Linux, open the terminal and run:

sudo nano /etc/hosts

On Windows, open Notepad as Administrator and navigate to:

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

Add this line at the bottom, replacing the values with your actual IP and domain:

123.45.67.89   yourdomain.com www.yourdomain.com

Save the file, open your browser, and load your domain. You are now viewing the new server directly.

Remove this hosts file entry as soon as your testing is complete so your machine resolves DNS normally again.

What to check before flipping DNS

Once your site loads on the new server, work through a structured checklist rather than clicking around randomly. Missing one broken element now costs you far less than discovering it after DNS propagates.

Check each of the following before moving on:

  • Homepage loads with correct styles and images
  • All main navigation links open the correct pages
  • Contact forms submit successfully and trigger confirmation messages
  • Any login or member-protected pages accept credentials
  • SSL padlock appears in the browser address bar on every page
  • Page load speed feels comparable to the old host

Step 7. Update DNS and monitor propagation

Once your site passes testing on the new server, you are ready to update your DNS records and point your domain to the new host. This is the final public-facing step in learning how to migrate a website to a new host, and it’s the moment your site officially moves. DNS propagation takes anywhere from a few minutes to 48 hours depending on your TTL settings, so understanding what to expect helps you avoid unnecessary concern when the switch doesn’t appear instant.

Lower your TTL before you change nameservers

Before you update your DNS, lower your domain’s TTL (Time to Live) value to 300 seconds (5 minutes) at least 24 hours before the planned cutover. A lower TTL tells DNS resolvers around the world to refresh their cached records more frequently, which shortens propagation time significantly after you make the actual switch.

Log into your domain registrar’s DNS management panel and find the TTL field on your A record or nameserver settings. Changing this value a day ahead of the migration is one of the most overlooked preparation steps, and it genuinely reduces the window during which some visitors land on the old server while others reach the new one.

If you didn’t lower your TTL ahead of time, proceed with the switch anyway but expect propagation to take closer to the full 48-hour window.

Update your nameservers or A record

Your new host’s control panel will display the nameservers or IP address you need to point your domain toward. Log into your domain registrar and make one of these changes:

Update your nameservers or A record

  • Nameserver update: Replace the current nameservers with the ones your new host provides (for example, ns1.newhost.com and ns2.newhost.com)
  • A record update: If you’re keeping DNS management at your registrar, update the A record to point to your new server’s IP address

Monitor propagation and verify the switch

Run this command in your terminal to check which server your domain currently resolves to:

nslookup yourdomain.com

Watch for your new server’s IP address to appear in the output. Keep your old hosting account active for at least 48 hours after the switch in case you need to reference any files you missed during the transfer.

how to migrate a website to a new host infographic

Wrap up and go live

You now have a complete picture of how to migrate a website to a new host without losing data or disrupting your search rankings. Every step in this guide builds on the last, so if you followed the process from backup through DNS monitoring, your site should be running cleanly on its new server. Keep your old hosting account active for at least two days after the switch, then cancel it once you confirm everything works as expected.

Migration is one of those tasks that rewards careful preparation over speed. A rushed migration creates problems that can take days to untangle, while a methodical one wraps up in a single evening. If you’d rather hand this off to professionals who handle this regularly, the team at Avatar Website Design can manage your migration from start to finish so you can focus on running your business.

Scroll to Top