去评论
dz插件网

最新版本DZx3.4怎么实现全站HTTPS教程

admin
2021/02/26 16:08:44
修改前注意备份!
查找修改文件discuz_application.php

找到 source/class/discuz/discuz_application.php (约第187行处)
  1. $_G['isHTTPS'] = ($_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off') ? true : false;
修改为
  1. $_G['isHTTPS'] = ($_SERVER['SERVER_PORT'] == 443 || $_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off') ? true : false;
查找修改文件avatar.php

找到 uc_server/avatar.php (约第13行处)
  1. define('UC_API', strtolower(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
修改为
  1. define('UC_API', strtolower(($_SERVER['SERVER_PORT'] == 443 || $_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
查找修改文件admin.php

找到 uc_server/admin.php (约第13行处)
  1. define('UC_API', strtolower((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
修改为
  1. define('UC_API', strtolower(($_SERVER['SERVER_PORT'] == 443 || $_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));
修改后台设置

后台 >全局 > 站点 URL,改为HTTPS

后台 > 站长 > UCenter 设置 > UCenter 访问地址,改为HTTPS

UCenter 后台 > 应用管理 > 应用的主 URL,改为HTTPS

做到这一步若还有问题,逐步排查模板、数据库等地方