15 May 2018
How to Mass Replace URLs to HTTPS in the WordPress Database
If you decide to change your domain name, or perhaps have finally gotten the dot com version of your domain, it is essential that you change and update all the old URLS in the database to the new URL. If not, many links on your page and content such as images will likely be broken and not work.
In addition to this, when you add an SSL certificate to your site, you would need to replace all URLs in the database to https. No need to do this all manually! With the download of the free plugin 'Search & Replace', you can do this all easily.
This tutorial will show you how to use the "Search & Replace" plugin to replace all URLs or any text data in the WordPress database without going through a lot of technical steps.
Step 1:
- Login to your WP Admin, then click "Plugins" on the admin sidebar
- Click on "Add New"
- Search for the "Search & Replace" plugin
- Click "Install Now" and "Activate" button
Step 2:
- The plugin settings will be available in "Tools > Search & Replace".
- Click on "Search & Replace" tab.
- In the list of tables, just check "wp_postmeta". Note that wp_postmeta is the database table where Themify Builder stores the data in. Selecting wp_postmeta table would only affect the data in the postmeta table. If you want to replace data in the entire database, check "Select all tables".
- In the "Search for:" field, enter the text that you want to search for.
- In the "Replace with:" field, enter the text that you want to replace. Let's say you want to replace all site URLs to https, you would enter your domain (eg. "http://yourdomain.com") in the "Search for:" field and enter the https domain (eg. "https://yourdomain.com") in the "Replace with:" field. You can pretty much replace any text data in the database, but this tutorial just demonstrates on how to replace URLs.
- Click "Dry Run" to make a test run. Running a "Dry Run" shows what would be replaced in the database.
- Once you are happy with dry run, uncheck "Dry Run", select "Save changes to database" and click "Do Search & Replace"
And then you're done!
We hope that you all enjoy this tutorial and find it helpful. Please feel free to share if you found it helpful, and what future tutorials you are looking forward to seeing in the comments below. Enjoy!
Jerry
May 15, 2018 @ 17:04
To Whom It Concerns:
I installed the Search & Replace plugin, but there is no “wp_postmeta” in the tables.
There is a “BBWEFpostmeta” in the tables.
I am sure this is the same as wp_postmeta, yet I do not want to take the chance and mess up my website.
Please advise.
I truly thank you for your time and consideration.
Regards,
Jerry Smales
Nick @ Themify
May 15, 2018 @ 20:18
Hi Jerry,
When you install WordPress, did you specify the database table prefix? Note that default is ‘wp_’. If you’ve renamed it, that explains why your table name is different. But it should be the same.
Paul H.
May 17, 2018 @ 01:39
Thanks for the tutorial. It’s helpful, but the Search & Replace plugin doesn’t actually work as you’ve explained.
If you try to replace the site URL using the “Save changes to Database” option you will get an error. The message says “If you want to change the URL (and you know what you doing), please use the export function and make sure you backup your database before reimporting the changed SQL.”
So while not that hard, there is an extra step for replacing site URLs. You have to export and then import a SQL file. It could be challenging for beginner users.
Pe Jung Labs
Mar 27, 2020 @ 18:53
Does not work, there are some http that doesn’t change. Starting from internal and external url, so how do you change it all? And some of the http is loaded from several plugins? When I try to change it manually it works but it will come back when I update, is there a solution for this?
Michael Davis
May 11, 2020 @ 18:55
If the Search & Replace plugin always gives an error, it may be due to incompatibility with other plugins. You may need to temporarily UNINSTALL (not simply deactivate) plugins such as Duplicator Pro to get Search and Replace to work.
Aliyu Ndagi
May 13, 2020 @ 03:32
Thanks for this info but there are some http that doesn’t change. Starting from internal and external url, so how do you change it all?
Nick @ Themify
May 13, 2020 @ 20:18
We can help you with this. Could you post on our support forum: https://themify.me/forum.
Rajiv Goel
Mar 20, 2021 @ 10:29
We have 779 links on HTTPS pages leads to HTTP page. When I used this plugin it show “DRY RUN: 1 tables were searched, 0 cells were found that need to be updated, and 0 changes were made.”
Can you suggest me how it is?
Thanks
Ranga
Jun 07, 2021 @ 05:05
The Better search and replace didn’t quite help me. I wanted the media urls in the post to be converted from http to https.
Instead, I logged into PHPMyAdmin and used the search and replace function there. Took just 5 minutures.
You need to be very careful though. A small screw up can be disastrous for your site.
Use the search and replace function and just input http://% -> https://%
Of course, the downside is you need to do this in different tables. wp_posts is where you have the majority of the changes to be made though.
The SQL search and replace is safe because it doesn’t replace straight away. it shows a before/after comparison and then at the very end you have the ‘replace’ button.
but having said that.. be very careful when using this option.
Tyler Rice
Jun 13, 2022 @ 14:17
Thanks! This is a bit easier than making changes directly within PhpMyAdmin. Appreciate the heads up.
davey
Oct 16, 2022 @ 22:41
Where is the themify builder data hidden at? We can’t affect any changes no matter what search and replace tool is used
Nick @ Themify
Oct 16, 2022 @ 23:47
The Builder data is stored in wp_postmeta table in json format. If you search & replace the database, it should be able to find.