discuz部署https(ssl)后前台普通会员无法登录
discuz采用: $_SERVER[‘HTTPS’] 方式判断,我司虚拟主机不支持同时也不支持$_SERVER['HTTP_HOST'],需使用$_SERVER['HTTP_FROM_HTTPS']进行判断,其他php程序同样适用。
source/class/discuz/discuz_application.php (第188行左右):
查找:
$_G['isHTTPS'] = ($_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off') ? true : false;
修改为:
$_G['isHTTPS'] = ($_SERVER['HTTP_FROM_HTTPS'] && strtolower($_SERVER['HTTP_FROM_HTTPS']) != 'off') ? true : false;
uc_server/avatar.php(第14行左右):
查找:
define('UC_API', strtolower(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
修改为:
define('UC_API', strtolower(($_SERVER['SERVER_PORT'] == 443 || $_SERVER['HTTP_FROM_HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
另:使用301方式强制将http跳转到https后会导致后台uc通信失败。