Our multisite WordPress installation has a URL of https://xx.com for the main domain, and - for example, https://yy.xx.com as a subsite. We're using WP's in-built domain mapping feature.

Media library links are still showing up as http://xx though, so any images used on the subdomains are flagged up as insecure. Only one subdomain - our most recent one - has media library links with a structure https://zz.xx.com. It's possible that the SSL certificate was installed after the other subdomains were created, but before ZZ was: I'm not sure.

How can I get WP media library links all showing up as https:// - and preferably with the subdomain in the URLs?

Ideally I'd like to do it without a plugin if possible. Thanks!

  • It is most likely due to wordpress inserting the whole hard-link including the domain and http(s)://. This is a usual problem for websites that are developed locally including http and only get switched to https when they go live.
    – marvinpoo
    Dec 13, 2018 at 10:54

3 Answers 3


Replace all links before the installation of the SSL (you can update the links via SQL)

Your wordpress should throw out https:// links now after the installation of the SSL certificate. This problem is due to wordpress decision to insert full links when inserting media through the editor.


You didn't mention if you have an htaccess that is redirecting http links to https. Have you tried this:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Place it before your WP lines in the htaccess file.

Although you can use, as suggested, a search/replace plugin (I like "Better Search and Replace" to go through the entire WP database and search for http://www.example.com and replace it with https://www.example.com .


To force WordPress to use HTTPS for media library links on your multisite installation, you can add the following code to your wp-config.php file:

define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_CONTENT', true);

This will force WordPress to use HTTPS for all admin and content pages on your site, including media library links.

To use the correct subdomain in the URLs, you can use the WP_CONTENT_URL and WP_PLUGIN_URL constants in your wp-config.php file. For example:

define('WP_CONTENT_URL', 'https://' . $_SERVER['HTTP_HOST'] . '/wp-content');
define('WP_PLUGIN_URL', 'https://' . $_SERVER['HTTP_HOST'] . '/wp-content/plugins');

This will use the current subdomain in the URLs for your content and plugins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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