How to use WordPress multisite with mixed HTTP and HTTPS sites?

I have a multi-wordpress installation (3.x) with 5 sites and only one of them is using SSL.

All of these are running on their own domain, and the http://ssldomain.com forwards to https://ssldomain.com.

Still, this seems to break wordpress upgrades.

Now I get a message:

Upgrade Network

https://nonsecureddomain.com

Warning! Problem updating https://nonsecureddomain.com. Your server may not be able to connect to sites running on it. Error message: SSL: no alternative certificate subject name matches target host name ‘nonsecureddomain.com’

It seems that at some point WP decides to go HTTPS for this domain, where it is not supposed to.

The network itself is the one running on HTTPS(SSL), and what concerns me is that

https://mydecureddomain.com/wp-admin/network/site-info.php?id=5

Is listing the site with a hardcoded HTTPS prefix which seems to to be configurable?

enter image description here

4 Answers
4

Thanks to @Sorin for posting the trac. From there I found a solution using just filters in functions.php (so no editing the core)

Thanks @mensmaximus for posting there:

Link: https://core.trac.wordpress.org/ticket/33887#comment:3

<?php
add_filter( 'network_admin_url', 'mmx_network_admin_url', 1, 2 );
function mmx_network_admin_url( $url, $path ){
    $url = "https://my_master_domain/wp-admin/network/" . $path;
    return $url;
}

add_filter( 'admin_url', 'mmx_admin_url', 1, 3 );
function mmx_admin_url( $url, $path, $blog_id ) {
    $blog_id = ( $blog_id ) ? $blog_id : get_current_blog_id();
    if ( preg_match( '|^http(s)?://|', $url) ) {
        $blog_details = get_blog_details( $blog_id );
        $url = $blog_details->siteurl . '/wp-admin/' . $path;
    }
    return $url;
}

Leave a Comment