A few weeks ago, the other Web Dev Fellow and I were tasked with migrating a couple of WordPress sites. The challenge: doing it without a plugin.
As a Web Dev Fellow at Center Centre – UIE, we maintain, update, and edit the WordPress sites that our customers visit, We have the legacy site, UIE.com, which has been the main landing page for Center Centre – UIE for many years. The company grew and changed their name from UIE, or User Interface Engineering, to Center Centre – UIE, which was a combination of their original company and the UX Design School based out of Chattanooga, TN. The website for this school was located at the url centercentre.com. We also maintain Articles.uie.com, which is a collection of articles written by the CEOs and other contributors. Along with these WordPress sites, the other Web Dev Fellow, Shayne, and I create, manage, update, and monitor static sites not using WordPress.
Like many other small schools, COVID forced the UX Design School to close its doors for an extended amount of time. After two years, the company was ready to move their main landing site to centercentre.com. This involved creating a subdomain for the UX Design School and migrating their legacy site at uie.com to the centercentre.com domain. The plan was to keep the legacy site and use centercentre.com as the most up-to-date landing page for our customers.
Moving the UX Design School Using a UI
Prior to this move, Shayne and I were continuing backing up some of our sites on DigitalOcean from a previous project. DigitalOcean is a cloud service provider that makes hosting sites incredibly easy. To make these backups, we used Plesk, a web hosting control panel. It allowed for us to interact with the file structures of the cloud server, access our MyPHP Admin web interface for our MySQL database, and make updates to the site backups as needed.
The process of migrating our UX Design School site was simple. First, we backup the site files and the database by making copies of each and saving them in a secure place. Then, we create a new subdomain within DigitalOcean for the UX Design School, uxdesignschool.centercentre.com. Within the files if this subdomain in the httpdocs directory, we added our site files and removed the index.html file since WordPress sites use index.php.
Once, the files were securely imported, we accessed the server database and used MyPHP Admin to create a database and copy the school’s site database into the new database. Then, we made changes to the the domain address and added a user. We made sure the WP-config file reflected any changes. We also needed to decrease the PHP version from 8 to 7, as this was an older site.
Finally, using CloudFlare’s delivery network service, we made sure that the DNS records reflected the IP address provided by DigitalOcean. Easy peasy, lemon squeezy.
Migrating the Legacy Site
Here is where we ran into some issues. We needed to essentially do the same thing as above, but using only the command line and FileZilla to access our servers and the files within them. My goal was to make this process as secure as possible and without using WP-admin or a plugin. The UIE.com site is using an older version of WordPress and we needed to manually move the files to centercentre.com, including the database.
I began by making the same kinds of backups of the files and the database and saving them to a secure location. Next, I went into the centercentre.com server and replaced the site files with the legacy site files. This took a while, as it was a large number of files.
I needed to create a database without the MyPHP Admin web interface this time. I studied up on the process of creating a database and populating it with the information from another database. Using the command line within the server, I accessed the server database. I used the
CREATE DATABASE command, then imported the database files into the new database.
Here was the tricky part. I created a user with the command
CREATE USER 'database_user'@'localhost' IDENTIFIED BY 'password'; Then, I had to select the user and grant them privileges:
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'localhost';
Great! We’re almost done. Now, I needed to update the domain name in
wp_option. Using the
UPDATE MySQL command, I made the changes needed to reflect the domain. If you’re interested in what my commands look like, you’re welcome to reach out to me on LinkedIn. I can go into more depth on this process.
Lastly, I updated the WP-config file to reflect the database information for the site. And now we have an updated working site: centercentre.com.
Obviously, this process is very nerve-wracking as moving files around on servers, especially for live sites, can cause a host of issues. We backed-up the files several times and tested each step of the way. Having a partner on this process, especially one as methodical and experienced like Shayne, facilitated this successful move.
In the future, I would love to have the chance to migrate a WordPress site using a plugin like BlogVault, JetPack, or WP Migrate DB. Having the experience of using both a UI and the command line to migrate sites helps me better understand this backend process and how a plugin that migrates sites accomplishes the task. I’m looking forward to more experiences like these, and using the skills I learned to grow our business and become a better Web Developer.