wp admin - How to make Media Library use HTTPS?

admin2025-06-05  5

I'm redesigning a site that originally didn't have a SSL. I copied the uploads directory, then did regular expressions on the wp db export file from the original site.

In the Media Library, none of the thumbnails are showing up.

In the developer console it is showing a bunch of requests to the root of the domain, rather than having the image names.

If I go to the URL that shows up in the inspector and use the https version, the image appears.

I've already tried wp media regenerate, but they still are not showing up. Where do I need to go to change the protocol the media library is using?

I'm redesigning a site that originally didn't have a SSL. I copied the uploads directory, then did regular expressions on the wp db export file from the original site.

In the Media Library, none of the thumbnails are showing up.

In the developer console it is showing a bunch of requests to the root of the domain, rather than having the image names.

If I go to the URL that shows up in the inspector and use the https version, the image appears.

I've already tried wp media regenerate, but they still are not showing up. Where do I need to go to change the protocol the media library is using?

Share Improve this question edited Dec 27, 2018 at 20:34 Dan asked Dec 27, 2018 at 20:27 DanDan 1491 silver badge15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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/newsite_name/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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749063849a316043.html

最新回复(0)