How to migrate WordPress website
How to migrate WordPress website (The proper way!)
So it’s time for you to migrate your WordPress site and you want to achieve this on your own?
Here’s how you are going to achieve this…and remember our team of experts is always here to help… or you can just provide us with your info and we will take care of everything.
From this tutorial, we will keep SSH command lines out, in order to make it super easy.
Before starting the migration make sure you have the following info ready.
- FileZilla or any other FTP client you are familiar with.
- FTP/SFTP access and phpMyAdmin to both hosting environments ( that’s mandatory )
So let’s start
Download the files via FTP from the old hosting
By using FileZilla connect to the FTP server of the old hosting and download all website’s files to your computer.
You can reduce the download and upload time by putting all of the files in a zip file (using cPanel File Manager that’s just a couple of mouse clicks. Make sure that you have enabled “Force showing hidden files” in FileZilla. The option is located in: Server > Force showing hidden files.
Upload the files via FTP to the new hosting:
Again using FileZilla connect to the new hosting FTP server. Locate the website’s directory (usually that’s public_html or httpdocs) and upload the files that you have already downloaded from the old hosting.
Check if you have moved the .htaccess file. Some users make custom rules there and it might be mandatory to move it.
Tip: Sometimes you will need to press F5 to refresh the folder and see any new files.
Export the Database from the old hosting:
Open phpMyAdmin. Locate the database and click on it. Go to the upper menu and click on the export option. Then click on Go.
If the Database is too big (more than 128-256MB you should ask the hosting support to export it for you via SSH (or use their Database backup solution). WP Plugins are often unreliable for that.
Import the Database to the new hosting:
We will need to configure and tune the website to work with the new hosting environment. I will assume that you have already created DB, DB user, and DB password.
Open phpMyAdmin. Locate the database and click on it. Go to the import option on the upper Menu > “Browse” the files that you have just exported in your computer and upload it.
If the Database is too big you should import it via SSH or ask the Hosting support to do it for you.
If you have moved your website to a different domain you should edit it and replace every old domain with the new one in it! This can be achieved by downloading the DB and edit it using Notepad++, Vim or similar text editor (just find and replace). In 99% of the cases, this will be enough.
Locate the wp-config.php and edit it:
Fill the credentials of the new environment – DB name, DB user, DB pass
/** The name of the database for WordPress */ define('DB_NAME', 'fill_the_db_name'); /** MySQL database username */ define('DB_USER', 'fill_the_db_user'); /** MySQL database password */ define('DB_PASSWORD', 'fill_the_db_password'); /** MySQL hostname */ define('DB_HOST', 'localhost'); //in 99% of the cases you should leave this as it is
Change the paths if there are any in the wp-confg.php file according to the new hosting environment;
Check for any errors in the error’s log:
You can have some minor issues with the new environment. Every hosting environment is different and if you can’t clean the errors alone the hosting support should help you.
Check for old absolute paths in the DB:
Some plugins leave absolute paths in the DB and if you leave them this can lead to crashing of the website or at least performance issues.
You can download the DB and search and edit with Notepad++ or similar text editor.
I’m not recommending the usage of plugins to migrate websites. If you want to do it right do it manually.
Optional but recommended!
Check your file’s permissions:
Open your cPanel File Manager and verify that all folders are 755 and all your files 644
If you have access to SSH run the following commands IN public_html:
find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;
Note: If you are not sure what are you doing just ask our friendly support personnel to help you or do it for you FREE
Leave a Reply