How to Migrate WordPress Site To Another Host or Domain Name
Moving your WordPress site to a new host or domain is not only easy, it’s necessary if you’re moving hosting providers. This article walks you through the process of migrating your WordPress site with an efficient and safe method.
How To Migrate WordPress Site
The first step is backing up all of your files on the old instance so they can be restored later. Then, install WordPress at the new location and configure it to match the settings on the old one. Lastly, restore our backup and import any content that needs updating from your old installation into this one! The whole process might take an hour or two depending on how many posts you have, but will save time in case anything goes wrong with your current server setup while also giving you more freedom in where.
In this article I will discuss about different ways to migrate your WordPress site. There are a few types of WordPress Migration: Migrate WordPress site to a new host or migrate WordPress site to a new domain name (*or domain name change – it’s the same story).
WordPress Migration Differences Explained
Migrate WordPress site on a new host – John is client of the Hosting & Hosting Media Servers, a local hosting provider from Seattle. Unsatisfied about the hosting service he is paying for good bucks, he decided to move his website to another hosting company. Basically, John will move all the website files (WordPress files and Database) to the new server he already chosen. After the WordPress transfer, he will go to the Domain Name Panel (on the domain name provider’s site) and renew the Name Servers (ns1.hostingandhostingmediaservers.com, ns2.hahms.com) with the nameservers of the new hosting provider (ns1.newhostingprovider.com, ns2.nhp.com). In order to migrate his website to another host, John followed the steps specified at the point 5 below.
Migrate WordPress site to a new domain – John is satisfied about the hosting services he receive from the H&H Media Servers, but he decided to change the domain name of his website, from oldJohnSeattle.com to newJohnSeattle.com. He already bought the new domain name. He goes to the Domain Name manager and configure the Name Servers with the ones provided by H&H Media Servers. After that, in order to configure his new website address, he did what is explained at point 4.2 below.
The two paragraphs above are just a regular explanation. I highly recommend to follow (or to read, at least) the entire article, to familiarize with the WordPress migration process.
- 2.1: What is a Full Account Backup?
- 2.2: What is the Home Directory Backup?
- 2.3: What is the MySQL Database Backup?
- 5.1 Uploading The Site Database To The New Server
- 5.2 Connecting the database with the site
- 5.3 Velvet Blues Update URLs
If you want to manually transfer your WordPress site to a new hosting server, here is how you should proceed.
1. First Thing First: Take a Full Backup of Your Site.
Yes, this is mandatory. In fact, I recommend site backups on any action you perform over your site: Before install a new plugin or update one, installing or updating the theme or updating the WordPress CMS. In some cases, your website may crash due to a plugin conflict, so you may lost your work on your site.
Also, from time to time, it’s better to save a full backup of your site(s) into your PC, and not on your server, because you don’t know what will happen with the server itself (See the OVH fire, from the beginning of 2021).
2. How To Backup Your Site From cPanel
Most of the hosting servers provides the cPanel interface. There is an easy way to backup your site: To quickly access your cPanel, go to -> yoursite.com/cpanel or yoursite.com:2083.
Once you are in the cPanel interface, in the search bar type “backup“, and the backup application icon will appearing. Click on it.
As you can see, there are 2 main backup buttons: Download a Full Account Backup and download a Home Directory Backup.
What is a Full Account Backup?
The Full Account Backup is a complex backup. You will download, not only your site, but all the folders inside your server (e-mails, databases, and even the trash folder). And if you have more than one site hosted there, you will download the others, too. Basically, you will download everything from your server. This isn’t a bad idea, but it’s a complex one, because you will have to search in some folders until you will get the full backup (database, website files and so on).
What is the Home Directory Backup?
The Home Directory Backup is what you need to access, in order to get a backup of your site, but more simple than the Full Account Backup (mentioned above). Once you press the “Home Directory” button, a tar.gz archive will start to download. After you’ve downloaded it, store in a safe place.
What is the MySQL Database Backup?
Once you downloaded the “Home Directory” backup, you will see the next step: Download a MySQL Database Backup. Here you will find your site(s) databases. Don’t worry, your site is using just one of those databases (if there is listed more than one db), so you don’t have to download all of them.
How to find what database your website is using?
In order to find your website database, you have at least two ways:
- Go to cPanel -> File Manager -> Public HTML -> and search for this file: wp-config.php. Once you found it, press Edit in the top bar (see the attachment above), and once again “Edit” -> Inside the wp-config file, locate this line: “define( ‘DB_NAME’, … ) – and the name, the user and the password of your db will reveal. Don’t change anything inside it.
- If you don’t have access to the hosting server/cPanel anymore, try this: From your backup archive you just downloaded (or you downloaded in the past), repeat the steps above.
***Don’t forget about this wp-config.php file, because we will talking about it later***
Downloading a database backup from cPanel:
So, once you know the name of your site’s database, go under “Download a MySQL Database Backup” and download the right one by pressing the name of it.
3. How To Backup Your Site Through FTP
Beside creating a backup through cPanel, you can also create a manually backup through FTP. For this, you may use a free software called Filezilla (Download from here). Download the soft, and install it on your machine. Once the soft is installed, get the FTP credentials from your hosting server: FTP (Host name, User and Password). It is not mandatory to insert the port (:21, for example).
1. To get the FTP credentials from inside the cPanel, go to the cPanel interface (yoursite.com:2083 or yoursite.com/cpanel) and type this in the search bar: “FTP”.
2. Access it by clicking on the “FTP accounts” button. On this page, you will setup your new FTP credentials, or get the existing ones. If you don’t have a FTP account, create one:
3. Log in (is the username you will insert later in the Filezilla), Domain (is the FTP host – in this case: ftp.websitesseller.com), Password( you already know what it is). In the Directory field you can insert the level the new FTP user can access (root level or site level).
4. At the bottom of the page, you will find Special FTP accounts. These accounts have full permissions, and you can access the root of your server.
To configure the Filezilla with your credentials, see the attachment above.
Once you connected, navigate to your site’s files. If you have just one site installed on your server, it will be in the “public_html” folder. If you have more sites, each folder is usually named as the name of your site.
About the Filezilla Interface
In the left side is your computer. In the right side is your server.
In the bottom part, you will see the transfer (running, cancelled and completed file transfers).
Once you identified the right site’s folder, you have to copy the whole files (press CTRL+a) and download them into your computer (see the attachment below).
In my case, I have a dedicated HDD (4TB) for my personal and clients backups, so I create a new folder on that partition, name it with the corresponding domain, and save the files there. In this way, I stay organized and, when I need a backup, I easily find it.
Why I Prefer cPanel Way Instead of the Fillezila Way?
Sometimes, Filezilla may generate errors (due to your internet connection, windows issues, etc). cPanel generate the backup in the first instance, and start to download into your computer after it was generated, avoiding any crash. Filezilla will live-download each file, so if there is a temporary lost internet connection, some of your site files may not be properly downloaded. Luckly, Filezilla will show you that cancelled files into the third field from the soft interface (the bottom field – I wrote above about it). So, if you see such file, right click on it and select “process que“. As a general rule, even after everything is marked as “completed“, you should manually check before delete the site files from the old server.
Now you have a full backup of your site saved into your computer. Make a copy of that archive and save it in a separate folder (and don’t touch it, until you really need). To see the backup files, extract the archive (the downloaded one, not the copied one), and you will see the site files.
4. Configuring The New Hosting Server
Migrate WordPress Site: Uploading the website files to the new server
- When you bought the new hosting subscription, if that hosting is only for 1 site, you already inserted the domain name into the “domain” field of your hosting provider.
- If the new hosting is not for a single website, or you not typed the right domain name, do this:
Go to: cPanel -> type “Add” in the search bar, and:
- Go to “Domains”, to check if the domain is there or not. You can also see the domain in the right side of the cPanel.
- If the domain is not listed, go to “Addon Domains”-> and in the “New domain” insert your domain name (yoursite.com). The subdomain and the document root fields will auto-populate. Check “Create an FTP account associated with this Addon Domain” and press “ADD DOMAIN”.
*** In this phase, the domain wasn’t transferred, because you didn’t point it to the new hosting server. I will explain below how to do it. ***
—HOW TO MIGRATE THE DOMAIN NAME—
Your new hosting provider may already sent you the login credentials and the information about your new hosting. Somewhere in that file/message, you will find these lines: NameServer1 (NS1: and IP address) and NameServer2(NS2 and the IP address). Keep this file/message opened, and:
1. Go to your domain name provider -> Login into your account -> Go to “manage domains” (or something similar, it depends on your hosting provider) -> Manage DNS -> NameServer Settings/Change NameServers/ NS settings: In the NS1 field, insert the IP address specified in the message from the new hosting provider (there is already inserted the NS for the old server, so you can update them with the right ones). Same with the NS2. Now hit “UPDATE”/”Change”. Usually, the change will be completed in a few minutes, but in rare cases, the change last between 24h and 48h, so don’t worry too much if there will be any delay.
2. Once the Nameservers were updated, your domain name is connected with the new hosting server.
5. Upload Backup To New Host
You can start to upload the backup archive in two ways:
*Through FTP (follow the steps above to connect to the new host – see image 7 – and change the old credentials with the new one)
*Through cPanel – I don’t recommend the “Restore a Home Directory Backup” feature, so I will suggest you a better way below.
Go to: cPanel -> File Manager -> Public HTML: Upload the backup archive here (follow the steps specified in the attachment below).
Once the backup archive was uploaded, right click on the file-> Press on “Extract” from the drop-down -> Make sure the path is the right one -> Press “Extract”. Don’t do nothing anymore here. We’ll start to upload the database.
Uploading The Site Database To The New Server
Before uploading the database backup, you need to do the following:
cPanel -> MySQL® Database Wizard -> insert the database name (…). On this page you can:
- use the same name as on the old database (to find the old name, go to the saved backup from your computer -> open “WP-CONFIG.PHP” and see what the old database was named. Copy the name after the “xyz_” prefix. For example, the old database was named “wp123_NAME” -> you have to copy only “NAME”. You can proceed in the same way with the database user and password. The only thing you may have to change is the database prefix of for the new host.
- create new database credentials: On the page specified above (MYSQL…), insert a new database name (in this case: OMEGA) -> NEXT STEP -> a new username (SAGA) -> and password (you can use the password generator, but make sure you copied the generated password and save it somewhere, because you will need it in short time). -> Press “CREATE USER”.
***IMPORTANT: MAKE SURE YOU CHECKED “ALL PRIVILEGES” – SEE THE ATTACHMENT.
Now you have an empty new database created.
To upload the old database (the backup), go to:
- phpMyAdmin (*use the search bar above, if you don’t find it) -> In the right side you will find your newly created database (if you have multiple sites hosted there, you will see multiple databases);
- Click on the database name (in this case ***_omega) ;
- In the top menu, press on IMPORT;
- Choose your file (you must choose the SQL file from your database backup folder, you downloaded few minutes ago);
- Press “GO” (wait until the database is uploaded – The confirmation message).
Migrate WordPress Site: Connecting the database with the site
- If the new site is pointed to the same domain name, you don’t need to change anything.
- If the site is pointed to a different domain name, you have to:
in the phpMyAdmin -> Structure (top menu) -> search for wp(or what other prefix you have)_options -> modify the siteurl and the home url fields (click on “Edit” -> insert the full url of your new domain name here -> Press “GO”).
Connecting the new database with your site files:
Go to -> cPanel -> File Manager -> Public HTML -> wp-config.php, and make sure the credentials from there are corresponding with the new database credentials. If not, make sure you insert the new details (db name, db user and db password).
***Attention: If the credentials are wrong, you will receive this error: “Error Establishing a Database Connection”. To solve it, make sure everything is well typed.***
After that, login into your new website installation (better from a new browser, with cleaned history, cache and cookies), and install this free plugin: Velvet Blues Update URLs. After you installed and activated the plugin, go to Tools (left side in the admin dashboard) -> “Update URLs“.
- In the first field, enter your old url address: https://www.oldsite.com and in the second field insert the new url address (https://www.newsite.com). Make sure the http/https and www/non-www are corresponding to the old and new sites. If not, you will crash your site.
- Check every box specified in the 2nd step.
- Hit “Update URLs NOW“.
Now check your website (each page, menu item, etc) to see if everything is fine. If something seems to not working, you have to take the steps again, with more attention.
Also, after update, some links may point to the old address (custom links in menu, widgets, in footer, etc). You can edit those with the right address anytime.
6. After Migration Process:
Congratulations! Your WordPress site has been migrated. What you should do after?
1. Install or Activate the SSL Certificate
For the SSL certificate (https), you have the free option with LetsEncrypt (your hosting provider should give you this FREE option).
You have to do:
Generate through cPanel -> Search bar “SSL” -> LETSENCRYPT SSL -> RUN AUTOSSL
Install this free plugin: 301 Redirects
2. Re-create the website custom e-mails ([email protected]).
3. You may also want to secure your site. See here my tips about How to Secure WordPress site.
4. If you haven’t involved too much in your website administration, but you want to pay more attention to it now, see here the best WordPress plugins you should install on your WordPress site.
5. Also, here I have a comprehensive article about how to Speed up WordPress site.
6. Interested in the Google May Update? See here how to optimize your site for the Core Web Vitals
7. For more articles, check my Blog.
8. Happy? Please leave me a review on my Google page (just go on Google and search:”Websites Seller”, and you’ll find my GoogleMyBusiness listing. There you can leave your honest review.
With the information you’ve learned in this article, it should be much easier to migrate your WordPress site. But if for any reason anything goes wrong or you need help transferring your site, I am here 24/7 to assist with all of your needs. The tone of my services is professional and I will always treat you as a valued customer. What other questions do you have about migrating our WordPress sites?