I have migrated my WordPress blog many times. I have gone from HTTP to HTTPS and back to HTTP. I may likely go back to HTTPS in the future but for now, I am staying with HTTP.
Now, moving your WordPress site to SSL or another domain can be tricky. If you don’t do it correctly, you may lose your ranks in Google’s search result pages, block user access to your content and more. I’ve done it few a times and know what works.
Before changing your WordPress site URLs or permalinks please read this first.
There are many reasons why one would want to switch a WordPress blog domain. I had few myself. I switched to HTTPS because Google said so. I later realized how bad it impacted my AdSense income and switched back to HTTP.
So, before switching, please make sure it’s for the right reason. I know I’ve lost a whole lot of ranking switching my WordPress permalinks back and forth. I may get them back but will take a long time.
When you’re ready to migrate your WordPress blog to another domain or go SSL, follow these steps below.
Step 1. Backup your WordPress blog content and database. I you have root access to your Linux server, run the commands below to take a full backup of your database.
sudo mysqldump -u root -p database_name > database_name.sql
(Replace database_name with your WordPress database)
Next, backup your WordPress content, including images. There are many WordPress plugins that may help you backup your database as well as WordPress content.
Step 2. Change WordPress content Permalinks in the database. This is the most important part. You see, WordPress uses database links to reference content. (images, pages, users, etc). When you install WordPress for the first time using HTTP.. all content references will be stored in WordPress database using HTTP protocol.
If you later switch to HTTPS, these references may still keep the HTTP links, even though you changed WordPress site and home URLs to HTTPS.
Some of your images that were uploaded when you were using HTTP may still reference HTTP protocol. If you don’t make the necessary changes in the database, you may get Mix Content warning in your browser.
So, to properly switch WordPress links in the database, run the database commands below.
Sign on to your database using the commands below.
mysql -u root -p
Then run the commands below to update WordPress database post_content table entry to reference the new domain.
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.oldsite.com', 'https://www.newsite.com');
Next, run the commands below to update WordPress database meta table entry to reference the new domain.
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://www.oldsite.com', 'https://www.newsite.com');
Finally, run the commands below to update the WordPress site permalinks.
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://www.oldsite.com', 'https://www.newsite.com');
This can be applied to sites moving from HTTP to HTTPS or back to HTTP.. It can also be applied to site moving to a completely different domain.
Step 3. Monitor your sites and make sure all is right. if you run into issues, go back and follow the steps above or restore your blog content and database file.
The SQL statements above have been tested on this site with no issues.
Enjoy!
Frequently Asked Questions
How do I properly migrate WordPress permalinks from HTTP to HTTPS?
To properly migrate WordPress permalinks from HTTP to HTTPS, you need to ensure you set up 301 redirects, update internal links, and use a plugin like Really Simple SSL for a smooth transition.
What are the common issues faced when migrating WordPress permalinks to a new domain?
Common issues when migrating WordPress permalinks to a new domain include broken links, loss of search engine rankings, and potential user access restrictions. It's crucial to plan and execute the migration carefully to avoid these problems.
How can I backup my WordPress blog content and database before migrating permalinks?
You can backup your WordPress blog content and database by using plugins like UpdraftPlus or manually through your hosting control panel. Make sure to back up both the database and all website files for a complete backup.
What steps should I follow to migrate my WordPress blog to SSL successfully?
To migrate your WordPress blog to SSL successfully, you should install an SSL certificate, update your site URLs, implement 301 redirects, and ensure all content is loaded securely over HTTPS.
What is the significance of changing WordPress content permalinks in the database during migration?
Changing WordPress content permalinks in the database is crucial during migration as it ensures that all internal links, images, and pages are correctly referenced with the new domain or protocol, maintaining SEO integrity.
How can I avoid losing search engine rankings when migrating WordPress permalinks?
To avoid losing search engine rankings during WordPress permalinks migration, set up proper redirects, update sitemaps, inform search engines of the change, and monitor for any errors or drops in ranking post-migration.
What should I consider before switching my WordPress blog domain from HTTP to HTTPS?
Before switching your WordPress blog domain from HTTP to HTTPS, consider the impact on SEO, site performance, and user experience. Ensure you have a valid SSL certificate and a plan for handling mixed content issues.
Are there any recommended plugins for migrating WordPress permalinks to a new domain?
Yes, there are several recommended plugins for migrating WordPress permalinks to a new domain, such as Velvet Blues Update URLs, All-in-One WP Migration, or Duplicator. These plugins can simplify the migration process and help avoid common pitfalls.