Guide: Migrate Your Wordpress Site From One Server to Another
|Wordpress migration illustration|
P.S.: Please excuse some of the pictures. Currently, I'm testing a watermarking software. Watermarking is needed to prevent misuse of the pictures in this blog. Pictures will only be watermarked if I personally took or made them.
But, the problem with a lot of hosting platforms is that sometimes, we feel the urge to move. This urge can be caused by many things: cheaper rates, promotions, better and faster servers, etc. This move calls for migration, and for some people, it's a terrifying word.
Worry not, today I'm going to show you that Wordpress migration is not terrifying at all. I've already moved from one hosting to another for at least three times, either Technoverse or my other Wordpress projects. So yeah, the following method is already tried and tested.
Start with File BackupThe first step is to backup all the Wordpress files in your server. You can compress your whole site's directory then download it, or you can choose to download all your files using FTP (such as FileZilla or Cyberduck).
|Believe me, compressing before downloading is much faster than using FTP... If you're into that sort of thing...|
Remember, all files must be downloaded. Otherwise, you'll risk breaking your site in the new server later.
Continue with Database BackupIn case you don't know, all your site configurations and posts are stored in the database, including data for your themes and plugins. So yeah, they work together. Excluding one from another will render your site useless.
|Exporting your DB using PHPMyAdmin is fairly easy and straightforward.|
Identifying your Site's DBIf you're not sure which DB your site uses, you can look at a file named wp-config.php. It's located in your site directory. You can't miss it.
|The wp-config.php file is located on the outermost location inside your site directory.|
On the example above, test-db is the DB name your site is using.
Let the Migration Begin!Okay, so the backup is ready, and I assume your server is ready too. Let's start migrating, then.
Create Database in New ServerFirst, you'll need to create an empty DB for your migrated site. This may vary depending on your hosting platform, but be sure to remember the DB credentials:
|The DB Wizard in cPanel will guide you step by step to set up your new DB.|
- DB host address (usually localhost)
- DB name
- DB username
- DB password.
Update Your wp-config.php FileNow that you've created a new, empty DB, you need to tell your site to read from the new DB. Open the wp-config.php file, and make the necessary changes.
You should see a lot of this line: define('XXX', 'YYY'). Change the YYY (leave the quotes be) to your new configuration.
Most likely you'll only need to change four items:
- DB_NAME, which is the name of your DB.
- DB_USER, which is the username to access your DB.
- DB_PASSWORD, which is the password to access your DB.
- DB_HOST, which is the address to your DB. Usually localhost, but yours could be different.
|Under most and normal circumstances, you'll only need to update the four lines above.|
Upload the Files to Your New Server
|Uploading files in cPanel is straightfoward.|
Adjust the DB to Your New ServerIf you don't change your address/domain/URL, you can safely skip this step.
While the upload is going, you should prepare your DB for the new server. Open that SQL file you got from DB backup earlier, and replace your old URL with the new one.
|With the right text editor, you can easily and quickly replace all your old domain with the new one in the SQL file.|
|I love both Atom and Visual Studio Code because they're free, powerful, and cross-platform.|
|Import your recently-exported SQL file to "move" your DB to the new server.|
Check If Everything Works - Enjoy Your New Site!Last but not least, once everything's done, check if your site fully works. Try navigating here and there, taking a look at your posts, media files. You might want to take a look at your themes and plugins. In some cases, you might need to re-install them.
Everything works? Great. Enjoy your new site!
Alternative: Premium ServicesIf you feel that doing it yourself is too bothersome, there are some services out there that can do the job for you for a fee. Heck, your new hosting company might also offer this service.
|Fantasktic is one of the companies that provide Wordpress migration service. I never used them, though.|
Well, that's it. Not that difficult, right? I've tried and tested the above methods multiple times, so it should work. If it doesn't work for you, have your say in the comments below and I'll try my best to help. Finally, as usual, thanks for visiting and see you in the next article! :D