I recently noticed that a site that I manage, which was run on Yahoo! Small Business hosting, wasn’t quite performing up to par. The domain was taking a while to resolve, and it was making page loads feel a bit sluggish. It seemed that as soon as you were connected to the server the pages would load almost instantaneously, but actually connecting could take three seconds or more.
All of the other sites that I maintain are hosted on InMotion Hosting, whose performance is certainly superior to Yahoo!’s. So, for both ease of maintenance and improved performance, I set out on the seemingly simple process of migrating all of the site’s WordPress data from Yahoo! to InMotion.
Migrating WordPress data essentially comes down to two main components: wp_content and the database.
As I grabbed the wp_content folder over FTP, I searched through Yahoo!’s web interface to find a way to export the data from the database. While Yahoo! does offer a database backup feature, it doesn’t appear to be in a format that’s very portable, so I opted to install phpMyAdmin and export from there. Yahoo! made the phpMyAdmin installation simple, and I was able to export the entire database in SQL format.
Unfortunately, because I wasn’t willing to update the MySQL installation on Yahoo!, they were only able to install a significantly outdated version of phpMyAdmin. This defaulted to showing the SQL data in a giant HTML table, instead of prompting a file download. I copied the data from the table and pasted it into a new file in Notepad++.
On the InMotion side, I installed a brand new version of WordPress. I then swiftly wiped out this installation’s wp_content and uploaded my backed up version from the Yahoo! server. In InMotion’s phpMyAdmin, I dropped all of MySQL’s generated tables and imported the SQL file I saved earlier.
After everything uploaded, I took a look at the website. It bugged me about upgrading the database (presumably because I was running a slightly out of date version of WordPress on Yahoo!), which I did. On the surface, the site looked okay, all of the images were there and the layout were fine. However, upon closer inspection, it was clear that every post only had the first few sentences and all of the permalinks were broken. Wonderful.
First up: Posts.
To make sure it wasn’t WordPress displaying the posts weirdly, I checked the wp_posts table. Sure enough, only part of each post was there.
I went back to the SQL script that I had executed, and checked one of the posts. Everything looked fine (thankfully). So, why didn’t the current tables have all of this data?
I thought back to everything I had done. I recalled the Database Upgrade the WordPress forced on me, and figured that it may have played a part in the lost data. To test, I wiped out all of the tables and re-executed the script. No luck.
I looked closer at where the posts cut off, and noticed that it was always right between the first paragraph and second paragraph. Perhaps there was some sort of character encoding issue?
Sure enough, if you look back up at the phpMyAdmin screenshot, you’ll see that it expects a file encoded in utf8. And, it turns out that Notepad++ defaults to encoding in ANSI. The difference between these two character encodings forced phpMyAdmin to barf when it reached newlines. Converting the script to utf8, dropping all of the tables, and executing the newly-encoded script, fixed up the posts issue nicely.
While the posts issue was fixed fairly easily, the permalinks still wouldn’t resolve. Clicking anywhere past the homepage of the site would bring up a nice 404 Not Found error, as shown below.
I checked the permalinks settings in WordPress, and they appeared to be okay. I fiddled around for a while resetting them anyway, but it didn’t help. I made sure the .htaccess wasn’t interfering, and did just about everything else I could think of.
Finally, I decided it must be a plugin interfering. I looked at the plugins list and saw that Yahoo! had installed a plugin named “Custom Permalinks” by default. Quickly googling it seems that it’s a very Yahoo!-centric plugin, which obviously wasn’t necessary anymore. Removing it made all of the permalinks resolve perfectly once again.
Now that the site was in full working order once again, I got the chance to fiddle some more. I set up CloudFlare on the site, not because its traffic necessitates it, but because I’m interested in the technology (overall, I’m impressed). And, best of all, the performance of the site has greatly improved to the point where page loads don’t bother me in the least anymore.