我有什么代码才能使用HTTPS? [英] What do I have to code to use HTTPS?

查看:155
本文介绍了我有什么代码才能使用HTTPS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在标准的宣传册网站中,我有一个子系统,其中私人数据在一系列页面中来回传递。该网站现在已经完成并且没有使用HTTPS。

Within a standard "brochure" site I have a subsystem where private data is passed back and forth in a series of pages. The site is done and working now without HTTPS.

有人能指出我需要做的步骤列表,在网站的安全部分实施HTTPS ?

Can someone point me to a list of steps that I need to do, to implement HTTPS on the secure part of the site?

推荐答案

作为程序员,您唯一需要做的就是检查用户实际上是否使用HTTPS:

The only thing you as a programmer need to do is checking that the user in fact uses HTTPS:

if($_SERVER['SERVER_PORT'] !== 443 &&
   (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off')) {
  header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
  exit;
}

然后(拥有你的系统管理员)订单并在网络服务器上安装SSL证书。

Then (have your sysadmin) order and install a SSL certificate on the web server.

这篇关于我有什么代码才能使用HTTPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆