How to make Media Library use HTTPS?

Okay, the issue was my last regular expression that changed the http: to https: did not save. I reran the expression again and refreshed the page and it worked.

Here’s the gist of how to do this (with wp cli) for anyone who comes across this.

In the original site directory:

wp db export

This should create a .sql file with the original database name and a hash, like db_name-324ddsx9.sql. FTP that file to your new server/install directory. Then edit it with vi and perform the search and replace. You want to replace all instances of the original domain with the new one.

sudo vi db_name-324ddsx9.sql
:%s/oldsite_name.com/newsite_name.com/g
:%s/http\:\/\/newsite/https\:\/\/newsite/g
:wq

If you haven’t already, create the mysql database. Then from the command line – import the sql.

mysql -u root -p database_name < db_name-324ddsx9.sql

And that should have you set to go.

tech