Migrating your WordPress site for the first time can be a daunting task, if you do not have a step-by-step guide to help you out. Many website owners will hire outside help for the job, out of fear of damaging the website and losing important information. However, with adequate preparation, migrating a website can be a straightforward project that should go on without a hitch. In this article, we will take you through the steps and help you successfully migrate your site.
1. Backup your files
Before you make any significant changes to your website, it’s important to back up all your files. It is a good practice to have regularly scheduled backups, and it is a requirement when migrating a WordPress installation. There are two ways you can go about this. You can either go with a plugin, or you can do it manually. Plugins such as WPvivid allow you to schedule backups, set restore points, filter larger files, backup your themes and plugins, and store the files remotely among other features.
With the manual approach, you will need to use an FTP program such as FileZilla if you’re on the PC, or Transmit, if you’re on Mac. The process is simple once you understand how it works. You will need your SFTP credentials (Google SFTP + your hosting provider to find out how you can get these credentials) in order to connect to your hosting provider, and then download all the files from your directory.
2. Export the database
Exporting the database is even easier than downloading all the WordPress files. You will need to log into your cPanel account and click on the phpMyAdmin application. There, you will have to select your installation’s database in the left hand sidebar, and click on the Export tab. The “Quick” export is the default selection, and it is thorough enough for most site migrations.
3. Create a database on your new hosting option
Next, we will create a new database on the target hosting service. Log into your new cPanel, and start up the MySQL Databases application. Create a new database and MySQL user, and connect the two with the “All Privileges” option selected. Make sure that you write down the database name, and the MySQL username and password. We will need them for later.
4. Make changes to the wp-config.php file
Now it is time to make sure that your new configuration connects to your new database. In order to do this, you will need to find the wp-config.php file in the backed up WordPress files and copy it to a separate folder on your computer. You will need it in its original state in case something goes wrong with the migration process.
Open the file in a text editor, and search for the following line:
The second part of the line – ‘db_name’ will match the database name from your old webhost. Remember how you wrote down your new database name previously? Replace the old database name with the new one.
The second and third lines that need to be changed are:
The process for these two lines is identical to the process for your database name. The ‘db_user’ and ‘db_pass’ sections need to be changed to match your new username and password.
5. Import the database
With the new database connection in place, it is time to import the database from your previous host. Go to the phpMyAdmin application in your new cPanel, select your database from the left hand sidebar, and go to the Import tab. You will see a File to Import section, with a Choose File button. Click it, and select the database that you’ve exported from your old host. Uncheck the Partial Import box and click Go.
6. Upload the files
In order to upload the file, you will need to connect your new web host using your FTP program, using the process we’ve outlined previously. The files will need to be uploaded to your public_html folder. Make sure you keep the files on your computer, just in case something goes wrong with the process.
7. Define the new domain
Sometimes when building a website, you may have direct links to your previous URL for images and pages. When migrating, this URL will no longer be active, and you certainly don’t want portions of your new website directing users to these locations. It is also likely that the website will not run at all when you have these URLs in place. Don’t worry though, fixing this issue is very easy. You can download the Search Replace DB script from github, and just replace the old URL with the new one. The final step would be to reconfigure your DNS settings so that your records point to the new IP address. This process can be different for each hosting provider, and you should be able to find this information on their website. After you have changed your DNS, you may have to wait for up to 48 hours before the new registration is active, after which the migration should be complete.
If you have any questions regarding this process, or if you feel like you need a helping hand, contact us today!