WordPress migration can be a stressful experience, but – trust us on this: it needn’t be, if is properly planned and prepared. Website owners may want to migrate their WordPress website to a better host for an entire palette of reasons, but only a few of them are willing to venture into this by themselves.
If you are among them, just follow these instructions and you will find out that migrating a WordPress website isn’t all that scary.
Step 1 – Backup Your Files
To accomplish this, you’ll need some of FTP clients (Total Commander or FileZilla) or you can use File Manager from your cPanel (if you use hosting with cPanel).
Connect to your hosting using the access parameters your current hosting provider provided you with and copy all the files, including .htaccess file, into a separate folder on your computer.
Depending on the size of your website, this could take a while. In meantime, move on to step two – backing up the database.
Step 2 – Backup Your Database
This is simple. Log in into your hosting’s cPanel (if you use hosting with cPanel) and launch the phpMyAdmin application.
On the left hand side, choose the database containing the data of your WordPress website, and then click Export. Up to here, all the setting are as they should be, so you can click Go. A file containing all the info on your database will be saved on your computer.
If your current host does not support cPanel, contact them in order to find out how you could backup your database – they may be kind enough to do it for you.
Step 3 – Make a Database On New Hosting
We assume you have already purchased a new web hosting plan and made it active. If not, there’s a quick and reliable solution here.
In order for your WordPress website to work again, it needs to have a database, similar to former one on old host:
Log in onto new host’s cPanel and click MySQL Databases.
In field “New Database” fill in the name of new database (completely up to your likings), then click Create Database and that’s it – you have created a new database!
In MySQL users section fill in the fields username and password (in Password (Again) field you should repeat the same password). Click on Create User.
In Add User To Database section, under User: choose the user you created in previous step, and in field Database choose the base you created. Click Add and allow all privileges.
VERY important: make sure you write down all the parameters you have set in this step, you’ll be needing them soon.
Step 4 – Configure the wp-config.php File
In folder in which you have created your website’s backup in a distant first step, there is a wp-config.php file. Make a copy of it in another folder – just in case, should something go wrong. Open the original version of the file in a text editor (eg. Notepad ++) and make the following changes:
- Change the name of the database:
in line define(‘DB_NAME’, ‘db_name’); replace the parameter ‘db_name’ (with your database name from PREVIOUS host) with database name on new host.
- Change database username:
in line define(‘DB_USER’, ‘db_user’); replace the username so that it matches the username you created with the new database.
- Change the database password:
in line define(‘DB_PASSWORD’, ‘db_pass’); replace the password to match the one you created with the new database.
After making these changes, double check your entries and save the files.
Step 5 – Import Data Into New Database
What we have done in step number two, we will now repeat, but in reverse and on new host.
Log in into the new host’s cPanel and launch the phpMyAdmin application. On the left, choose the database you created in step 3 and click Import.
In “File to Import” part click the “Choose File” and pick the file you created in step 2.
Turn off “Partial Import” option, check whether format is set to SQL and if so, you may click Go.
The time necessary for database to import depends on its size. After the process is finished, you will be notified that the operation has ended successfully.
Step 6 – Upload WordPress Files
New database is now set, wp-config.php file is configured properly, and that only means you’re all set to upload the files you downloaded from old host.
Connect to your new host via FTP – the same method you used for connecting to the old one, only using new parameters. Enter the public_html folder and copy all the files into it, including the configured wp-config.php file.
As in previous step, this may take some time. Do not delete files from your computer, for you never know what may go wrong.
Step 7 – Changing Links and Defining the Domain
We are nearing completion; however, if you decided that you will ditch the old domain as well as migrate the website, some more job needs to be done. If not, you can skip this step altogether.
Ever since your website came into existence, you were most likely putting links and inserting images into articles by uploading them manually and then linking them directly from server. The trouble is, this has now caused all the links and images to be broken as the true urls and links remained on old domain.
You can deal with this manually: in your database, find every entry where your old domain is mentions and change it with new one.
If you feel you’re not up to it, you may need the Search Replace DB script which will do the job for you. On the web page where you can download this script from there is also a brief manual. What you need to do is put the script into a special folder and launch it from your web browser via URL: www.yourdomain.xyz/script (where youdomain.xyz is your domain’s name plus the extension, and /script is the name of the folder inside public_html where you put the script. Follow the instructions and you will find your way around it in no time.
After finishing with using this script, it is compulsory to delete it from your web host for safety reasons.
Step 8 – Change Your Domain’s DNS
This could take a few hours, even, but it’s not up to you.
Before you’re able to launch and use your website on the new host, it is necessary to reconfigure DNS settings for your domain, since your domain still points to the the old host’s servers.
DNS change procedure varies from host to host. You should contact your domain register or the old host provider as they are sure to have all the needed details.
DNS servers changes could take up 24 hours. During these 24 hours it would be for the best not to make any changes on your website, because there is a possibility that you will make them on old host and they will not be visible once you have completely moved to the new host.
Step 9 – That’s it!
If you followed the instructions closely, you have migrated your WordPress website from old host to the new one with success. We truly hope it wasn’t all that complicated. If you did encounter some problems and you tried to migrate to our hosting, we will migrate your website for you. Feel free to contact us!