新梦想网络 > 客服中心 > 虚拟主机问题 > 正文缩放字号: [收藏本问题]

discuz部署https(ssl)后会员无法登录的处理办法

时间:2016-12-27来源:新梦想网络 作者:新梦想网络 点击:

  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通信失败。
 

    TAG:

    下载此文章 (欢迎转载,请注明出处:http://www.xmxwl.net/help/host/20161227/13803.html)