Mixed content Multisite Plugin conflicts

Hyperlinks to external urls getting replaced to https

There are two situations where a normal hyperlink to an external url could get replaced to https

Website domain is part of the external domain

When the external url is for example http://domain.com.au while the website url is http://domain.com this can happen. Really Simple SSL replaces all instances of the own website domain in the html to https. In this edge case the external url gets replaced as well: replace http://domain.com in http://domain.com.au to https, and the external link is https as well. This can be fixed by excluding this url from the mixed content fixer: https://really-simple-ssl.com/knowledge-base/exclude-url-mixed-content-fixer/.

Links to non https sites on the same multisite network

WordPress uses the home_url() function to return the URL’s in a website. This function returns an https URL when the current website is on https. This means that if you link to another site on your network, which is not https, but the current site is https,  WordPress will return a https link anyway. I’ve created a fix for this WordPress behaviour:

add_filter("set_url_scheme", "rsssl_check_protocol_multisite", 20, 3 );

function rsssl_check_protocol_multisite($url, $scheme, $orig_scheme){
    if (is_multisite()) {
    //get blog id by url.
    //make sure the domain is with http, e.g. http://domain.com
    $domain = str_replace("https://","http://",$url);
    //remove http:// from the domain. e.g. domain.com
    $domain = str_replace("http://","",$domain);
    $blog_id = get_blog_id_from_url($domain);
    // exit if no blog id was found.
    if ($blog_id==0) return $url; //no blog id found
    
    //request the blog url and return it. If it is http, the returned url will now also be http.
    $url = get_blog_option($blog_id, "siteurl");
  }
  return $url;
}

If neither of these is the case with your site, Really Simple SSL won’t be the cause in your case, as it does not replace external URL’s. In that case I would check if another plugin might be causing this.

Related Articles

  • Images not found with Photon from Jetpack

    Some websites using JetPack have Photon activated. Photon is an image acceleration and editing service, where the images are served from the WordPress cloud. In some cases, there are issues...
  • Plugin conflict force rewrite title Yoast

    * Update* This issue should be resolved in the 2.4 version. I left the Yoast check for now, but this warning will be removed in future versions. If you have...
  • Removing mixed content fixer comment from html source

    Really Simple SSL adds a html comment to the source of your website. Since 2.4 this is a data attribute. This makes it easy to check if the mixed content fixer...
  • Using safe mode

    Migrating to SSL can cause unexpected side effects. When caching is causing redirects, or a plugin redirects back to http, or other such issues, it can be helpfull to activate...

1 Comment

Leave a Comment