$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>wp admin - How to make Media Library use HTTPS?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

wp admin - How to make Media Library use HTTPS?

matteradmin10PV0评论

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far