K. Weber
K. Weber

Reputation: 2773

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:

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

Upvotes: 1

Views: 2620

Answers (1)

Hassan Kazem
Hassan Kazem

Reputation: 89

  1. validate your server ssl for errors: http://www.digicert.com/help/
  2. use this wp plugin: http://wordpress.org/plugins/force-ssl-everywhere/ ssl on logged in

Upvotes: 1

Related Questions