WordPress Migration Weirdness

About 3 weeks ago, SE moved to a new server.  The WordPress installations were transferred (migrated) from the old server to the new server.  This caused some weird behavior.  I thought I’d document it for myself for the future migrations and also for others who run into the same problems.

Note: I’ve linked to the plugins and such that I refer to here.  No links are affiliate links or anything like that.  They’re just for your information.

1. All blog posts were 404 errors.  They would display fine on a page but clicking the link to continue reading the rest of the post resulted in 404 (page not found) errors.

What worked for me:

  • Settings -> Permalinks
  • Under Common settings (This is for 4.1.x or 4.2.x at this time.  It may change in the future of course!), change the current setting to anything else.  Save.  Go back set it to what it was. Save again.    If you only change it and don’t change it back, it has the potential to make a mess of existing posts.  If someone has saved a link to a post directly, this will break it.  Additionally, all of the links that Google and other bots have indexed will all also produce 404 errors which will lower your site’s ranking until fixed or re-indexed.  I know this from experience. If you’ve already done this, there are plugins for WordPress that will let you redirect the 404 to the correct page.  That’s what I had done in the interim when I did this 2 years ago.

2. Can’t upload pictures (or probably other media as well) – a generic http error is generated and the upload fails.   This one is difficult to troubleshoot because you get no information on what the error was.

What worked for me:

  • There was something “rogue” in an .htaccess file.  Locate all of these files that speak for this installation – pay special attention to the wp-admin folder and either remove the file or edit the contents accordingly.  Do NOT use .htaccess to password protect the WP-Admin folder.  This can lead to a ton of problems that are difficult to troubleshoot.  Others have had success with file folder permissions and such.  Those changes didn’t work for me because the folders were already set correctly.

3. Background Updates were not working, emails were not being set to that effect and manually checking resulted in “No updates found” even though I knew for a fact that there was a critical security update for WordPress.

What worked for me:

After spending a fair bit of time today looking for others who’d had the “No updates found” problem and solved it, I realized that there was a chance that this was a remnant from the migration as well. This finally dawned on me when I realized we were still on 4.1.1 when at least 4.1.2 and 4.2 had also been released based on WordPress.org forum questions.  Armed with some instructions about how to manually upgrade the installations, a plugin to install to check permissions and other things that affect background updating, some possible server updates lately that might have broken updating and a wonder about caching problems, I settled in for the “day” to resolve the issue.  Imagine my surprise when it was fixed 10 minutes later.

When I clicked on Plugins -> Add New and searched for the Background Update Tester, suddenly there were 6 Updates waiting for me in the dashboard.  My suspicion is that, sort of like the permalinks that something needed a “reset” and looking for the plugin reset it and allowed WP to see the updates status correctly again.   I will be watching this carefully from here on and troubleshooting the email sending portion if it fails to let me know of an update or failed update again in the future.  For now, we were able to update and that’s the most important part.  Besides, I can’t troubleshoot or fix something that’s currently working. 😉  I will monitor the situation and update if the situation is not fixed.

4. The site was slow and Wordfence had not alerted me to any out of date plugins but had been letting me know there were admin logins.  This was possibly the most concerning issue I ran into.  More the lack of notifications than the slowness of the sites, though that was bothersome too.

What worked for me:

Upon clicking on the Wordfence -> Scan link, I found a scan in one of the sites that appeared actively “Running” but dated March 23!!  This is prior to moving the site to the new server (but possibly about the time I’d zipped that web directory up. Another site said April 9th.  I immediately canceled the scans and started new ones.  That gave the scans a current date and they found no issues.  Keep in mind I had updated the site in the third point above.   I suspect there was a temporary file that was copied to the new server in the web directories.   The serving of webpages seems to have perked up a little too, though it may be coincidental.   I will monitor this and update if the problem recurs.

The take aways for me in this situation are:

1.  Even a direct copy preserving folder and file permissions will likely result in some troubleshooting in a WordPress migration.

2. Touch every single module in WordPress right after the migration is finished.  Make sure everything is working right.  Don’t assume that because one portion of a module or plugin is working that the rest is ok.  Initially, I had a very hard deadline for finishing this server (discontinued support for the OS it ran on) but I should have come back and done the final checks.

How about you?  Have you had these experiences and what worked for you?