4

I've been migrating customer WP installations to an SSL only server. For some reason some (but not all) of the media libraries seem to have gotten hard coded URLs involved. These are media objects that have been uploaded from the WP instance itself. If I look at them in the media library, the permalink shows up with the HTTPS address just fine, but most of the File-URL fields still read with the HTTP address. This is after changing the site URL in the settings.

What do I need to do to these installations so all the media embedded in pages doesn't break?

8
  • I would run a plugin like Velvet Blues Update URLs, and swap http://domain/ to https://domain/ - this will replace all instances in the entire database (and will also handle serialized data). Commented Feb 29, 2016 at 17:33
  • @TheDeadMedic No such luck. Running that plugin changed a whole pile of URLs for sure—thousands—but the file-url field on media items remains unchanged so I'm still having mixed content troubles.
    – Caleb
    Commented Mar 1, 2016 at 8:47
  • Did you make sure all the checkbox options were ticked when you ran the plugin? Esp. the guid field? Commented Mar 1, 2016 at 10:28
  • Ok I just checked on my SSL install, and the URL field for an attachment is indeed non-https. However, this does not give me mixed content issues - both on the frontend & backend, all actual image links are HTTPS in the source. Commented Mar 1, 2016 at 10:30
  • @TheDeadMedic Interestingly enough it doesn't seem to be the SRC field that's messed up any more (it was). Now its the responsive image system and the SRCSET values that are not updating. The force-https-srcset plugin smooths that over, but it would be nice to just fix the DB somehow so they were all correct rather than having to continuously run a plugin to rewrite them at render time.
    – Caleb
    Commented Mar 1, 2016 at 11:32

1 Answer 1

4

Here's what I did (step 3 should probably solve your problem):

1. Update .htaccess File

Add the following to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

2. Update WordPress Site URL

Navigated to Settings > General and update the WordPress Address (URL) and Site Address (URL) to https.

3. Update Old http URLs

  1. Install the plugin Velvet Blues Update URLs
  2. Go to Tools > Update URLs
  3. Enter Old and New URL, e.g. Old: http://www.example.com and New: https://www.example.com
  4. Check all checkboxes and click Update URLs NOW
  5. Repeat steps 3-4 but remove "www" this time, e.g. http://example.com and New: https://example.com
1
  • I have followed these directions to the letter, however when viewing the images in media library, opening up an image's details, the url field is still display in http://
    – Nebri
    Commented Dec 8, 2017 at 15:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.