Force https on WordPress multisite

I’ve got a WordPress multisite and I’m trying to force https programmatically (better than via .htaccess as htaccess has many rules, set from cache plugin and the multisite itself).

The code I’m using is this one:

Read More
if ( FORCE_HTTPS && (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ))
{
    //echo("Location: " . "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
    header("Location: " . "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
    exit();
}

It’s working properly in main site but not in subdmoains, but curiously is I type https://subsite.domain.com it works properly, but if I go with this redirection I see a blank page.

The certificate is working properly and as I sayed, if I type the full adress I see everything ok

What’s going wrong or how can I force https?

Thank you

Related posts

Leave a Reply

1 comment