diff --git a/user/view.php b/user/view.php index f5d6a04d94c..2d2e9de794f 100644 --- a/user/view.php +++ b/user/view.php @@ -50,7 +50,11 @@ if (!empty($CFG->forceloginforprofiles)) { require_login(); if (isguest()) { - redirect("$CFG->wwwroot/login/index.php"); + $loginurl ="$CFG->wwwroot/login/index.php"; + if (!empty($CFG->loginhttps)) { + $loginurl = str_replace("http://", "https://", $loginurl); + } + redirect($loginurl); } }