You have decided to take the plunge and add a SSL certificate to your website. You have heard that there is improved SEO if your URL starts with HTTPS and now the Chrome has added the actual words “Secure” and “Not Secure” in the address bar, perhaps more people are taking notice. Or maybe you want to add the ability to accept credit cards online. You contact your hosting company or figure it out how to do add the SSL certificate yourself but now you are left to deal with the links in your database that are HTTP and not HTTPS. What do you do?

One tool I have found to be very useful is the Search-Replace-DB-master script. Not only did I use it after adding SSL to my sites I also have used it many times when transferring a dev site to the new hosting. I thought it would be handy to share my quick cheat sheet on the Search-Replace-DB-master script.


First thing…

Make a backup of your database.

Download the Search-Replace-DB-master.zip file. If your server is running PHP 7.x you will need to use version 3.1.0 of the script. The download link is at the top of the page.  If your server is using 5.x download version 2.1.0 and the link is closer to the bottom of the page.

https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Unzip the file, you will have a folder “Search-Replace-DB-master”

Rename the folder to something obscure and shorter – I’m renaming it to “easy-sr”

Copy the folder to your server’s public facing directory, same place as wp-admin, wp-content, etc.

Did I mention you should make a backup of your database? If you haven’t done this yet. STOP and go do it.


In your browser type the location and folder name of the script you just uploaded and enter.

This will bring up the search and replace interface.  Enter the content you want changed and what you want it changed to.

In the actions section click on “dry run”


Review the report from the dry run and make sure it is what you expected to see. Make any adjustments to your search and replace prompts and do another dry run if needed.  Click on the links to view the changes that will be made.  Once you are happy with the results, click on “live run” to update the database.

Note: It may be necessary to run this a couple of times.  For instance if you have links that are http://mysite.com or http://www.mysite.com it will take a couple of rounds.


When you are finished with the script remove it from your server.  There is a delete me button at the bottom of the page.

 

And that is all there is to it!  Make sure you have a backup of your database.  Do the dry runs until you feel comfortable. Make a copy of your database, rename it and practice on that as well.