The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Force https on login.php - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Force https on login.php (/showthread.php?tid=822)



Force https on login.php - haydentech - 11-06-2017

I saw that there is a Force HTTPS setting in the admin settings. I don't necessarily want my entire site served via HTTPS, but I do want the login page to require it. Is there any way to force just the login page to use HTTPS?


Force https on login.php - mudmin - 11-07-2017

You can just drop the same code snippet we use in your login.php or (preferably) copy your login.php over to usersc/login.php, point the init to ../users/init.php and add this snippet somewhere near the top...


Code:
if (!isset($_SERVER['HTTPS']) || !$_SERVER['HTTPS']) {
Code:
$url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
Code:
Redirect::to($url);
Code:
exit;
Code:
}



Force https on login.php - haydentech - 11-09-2017

That worked perfectly. Thanks!


Force https on login.php - mudmin - 11-12-2017

Awesome! Glad to help.