It has come to a point where you need to move your website over to another server and you are stuck between taking a risk and doing it yourself or going ahead and paying a professional to do so.
Moving a WordPress might seem like quite a daunting task but it doesn’t have to be. We will run you through the whole process step-by-step to ensure your website is moved over to its new home, shall we begin…
The first step in moving your WordPress website to a new server or applying major changes to your website will be to backup all of your website files, let’s go through this process.
One could use various plugins for backing-up your WordPress website but we recommend taking the manual route. For this, you would need an FTP Program to do so (we will be using FileZilla for this tutorial but any FTP program will work). Connect to your web host using your FTP credentials supplied to you by your hosting provider and copy all of the files under your website’s public_html/wwwroot directory to your local computer.
Please Note *: It’s important to copy the .htaccess file as well which is set to hidden by default. You can set this under ‘Server’ > ‘Force show hidden files’ within FileZilla.
Depending on how big your website is it could take some time for the backup to complete, so in the mean time, we will be heading over to CPanel and then navigate to phpMyAdmin on our server to backup our database while we wait.
Backing up the database can be achieved by completing a few simple steps.
Firstly, click on the database you wish to export on the left-hand side of your phpMyAdmin page, next you’ll navigate to the ‘Export’ Tab on the top of the page and then select the ‘Quick Export’ option and ‘SQL’ format, next we can click on the GO button and this will export your database to your local computer.
Once you have successfully exported your SQL database and backed-up all of your website files we are ready to move on the next step …
Before we are able to move over our website files we first need to add a database to our new host account. Firstly we’ll log in to the CPanel on your new hosting platform with the login credentials provided to you by your hosting provider.
The steps to be followed:
It’s important you keep the database name, the username for the MySQL Database user and the password with you as we’ll be using this in the next step.
We are getting all the more closer to a successful website migration. Now we’ll have to go to our website files we’ve backed up and find the ‘wp-config.php’ file (this is the connection between our website and our database) in our public_html/wwwroot folder and open this file in any text editor e.g. Wordpad/Notepad/Notepad++.
Your “DB_NAME” should currently be set to the database on the old server, you’ll need to change this to your new Database name.
Your “DB_USER” should currently be set to the database user on the old server, you’ll also need to change this to the username you’ve created for the new database.
The last change we’ll have to make to the ‘wp-config.php’ file will be the password. Please change the password to the password you’ve created for the new user which you have assigned to the database.
You have now finished editing the ‘wp-config.php’ file so you can go ahead and Save & Close this file.
Now that we’ve setup our database on our new hosting server, we are ready to import the database we’ve exported in Step 3.
Firstly, login to your CPanel with the credentials provided by your hosting provider and navigate to your phpMyAdmin application. You can now select the database you’ve created in the left-hand side pane of the page and then select the ‘import’ tab on the top of the page.
Make sure ‘un-tick’ the partial import option and ensure the format is set to ‘SQL’. You can now click on the browse button and navigate to the SQL file you’ve recently exported.
The time it will take for the SQL database to import will depend on how big your database is.
With our MySQL database now imported and our ‘wp-config.php’ file now imported we are ready to upload the rest of our website files.
Using your FTP Program you can now connect to your new web host with the credentials they’ve provided you with.
Upload all of your website files including your edited ‘wp-config.php’ file you’ve previously backed up into the public_html folder. Once again depending on your internet connection and the size of the files, this process might take some time.
Once successfully uploaded, do not delete the website files off of your local computer as it’s always advisable to have a backup should something go wrong.
At this point we can see the light at the end of the tunnel, the last thing you’ll need to do is get in contact with your old hosting provider and have them point your DNS records to your new hosting provider. This process does take some time and the propagation could take up to 48 hours. It’s important that you do not make any changes during this period to ensure everything runs smoothly.
We’ve broken down this tutorial into the simplest steps we possibly could, If you’ve taken your time and followed these steps carefully you should have no issues with the migration on your website.
If you’ve successfully moved your WordPress website over to a new server or found some cool tricks along the way we’d love to hear them… Give us some feedback in the comment section below.
The Softserve Team