Over the years WordPress has become the “most trusted CMS” worldwide thanks to its large developer community, countless plugins, and scalability in terms of features and SEO.
WordPress migration may seem like a rather straightforward process, but often you end up with lots of issues as you finish. Whether you migrate to a new hosting, a new domain name or to a HTTPS address, there will be problems you have to tackle.
Here are the main problems you may encounter and how to deal with them.
There’s nothing worse than losing all or some of your files when something goes wrong. This can mean going back to an earlier version of the website which is both pricy and time-consuming.
You can easily avoid this common mistake by making a backup of your site before you start migrating it.
If your host doesn’t do backups automatically, you can either make a backup automatically, or use one of the many WordPress plugins that are made just for that. The most common ones are Duplicator, UpdraftPlus, and WP-DB-Backup. The latter one only works for making a database backup, so if you use it, make sure to make a backup of the website itself.
To make the most common manual backup, you will have to create backup files for your website and database. Go to your home folder in the file manager on the host website, and find the public_html file. Compress it to zip, and transfer the file to a place you want to store them – either on your hard drive or on the server.
Then, go to phpMyAdmin and export your database. Again, transfer it to the place where you plan to store it.
Downtime During Migration
The ugliest thing that can happen during the migration of your WordPress website is significant downtime. Imagine what would your visitors think if they find your site not working when they need it the most.
Downtime happens when you have transferred the files to a new web host, but the URLs lead the visitors to the old hosting. Obviously, there’s nothing there, and your visitors will see a 404 error.
The best way to go about migrating a website and testing it on a new host to ensure constant uptime is using an internal address that many hosts have.
If that’s not an option, use this little trick. You have to change the hosts file on your computer, this will make the website work on your computer only, while your visitors will be able to use the old host.
Find the hosts file on your computer. Run it in a Notepad as administrator. Go to your new host’s cPanel and find the Shared IP Address. Add a new line to the hosts file, and paste the Shared IP Address there. Then add your domain name. It should look like this:
Now, you can use your domain name to test the website at a new host. Once you finish the migration, delete this line from the hosts file.
phpMyAdmin Timing Out
The odds are your database is not just a couple of files. If your website has been working for a while, it can be rather massive. This is why sometimes phpMyAdmin can time out while trying to import or export it.
You can use wp import command in WP-CLI. It’s a free open source tool that is easy to install.
If you don’t want to waste your time on installing and learning WP-CLI, you can use SSH commands to export or import your database.
If that doesn’t work either, you can always cheat and contact the support.
URLs in Posts Not Working
It’s very common for the URLs leading to your previous domain to stop working if you migrate your WordPress website to another domain name.
There are two ways of making all the URLs point to a new domain. You have to run the following SQL query in your database provided by user markratledge:
UPDATE wp_options SET option_value = replace(option_value, ‘http://olddomain.com’, ‘http://newdomain.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = replace(guid, ‘http://olddomain.com’,’http://newdomain.com’);
UPDATE wp_posts SET post_content = replace(post_content, ‘http://olddomain.com’, ‘http://newdomain.com’);
UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘http://olddomain.com’, ‘http://newdomain.com’);
However, if your website has serialized arrays in wp_options as is the case in many sites, you’d be better off using Interconnectit. It’s a free tool that allows you to make replacements in your database without ruining serialization.
500 Internal Server Error
The problem with this error is that it doesn’t really tell you anything. However, there are a couple of ways of troubleshooting this problem that may solve it.
Sometimes a new host doesn’t have access to all your files. You’ll have to find the folder permissions and allow the host to access the files.
If this doesn’t help, check your .htaccess file. Troubleshooting is rather easy here. Rename your .htaccess file and reload your website. If this doesn’t fix the problem, generate a new .htaccess file and reload the website again.
This didn’t fix the problem? Delete the new .htaccess file and restore the old one. Now, you’ll have to go to your PHP settings and increase the memory limit. It can be set rather by default.
The next step is to deactivate all WordPress plugins and troubleshoot them one by one to see if any of them is causing the issue. If your website loads well without one of the plugins, reinstall it.
Error Establishing a Database Connection
There are a couple of ways to solve this problem. The first thing you have to check is your wp-config.php file. It’s common to make a typo in database name or database username that prevents the site from connecting to the database.
If there are no mistakes in the wp-config.php, go to www.yourdomain.com/wp-admin. If the error page says your website has to be repaired, this was the cause of the problem.
To fix this, open the wp-admin.php and type in the following string:
Go to www.yourdomain.com/wp-admin/maint/repair.php. This will fix the errors in your database. When you’re done, delete the string mentioned above from wp-admin.php.
If none of the above works, contact the support.
SSL Certificate issues
If you’re an eCommerce website, it’s essential to have an SSL certificate. Here’s what you should do if something goes wrong with the migration.
If you get the NET::ERR_CERT_INVALID error, the odds are you didn’t change the domain name in your certificate. An SSL certificate is given to a specific domain name, and if you changed it, it won’t work. Reinstall the certificate manually to fix this problem.
If you get mixed content errors, this means some URLs on your website still point to HTTP version of the website. You have to find and replace them to HTTPS URLs either manually or by using a plugin like SSL Insecure Content Fixer.
Some errors are rarer than others. You can find ways to fix them by browsing the WordPress Stack Exchange or contacting support. These tips will help you cover most problems that happen during WordPress migration.