douqianmin5367 2014-01-01 16:33
浏览 35
已采纳

我该如何阻止https

I have a website that can be accessed both with http and https. The website has a form that brings the user to another site on another server. So when I use https and the form is submitted, I get a warning that the data are being sent insecurely.

The second server does not support https, so I figured that the fastest and easiest is to prevent the first website from being accessed through https.

Is there a way to do that (with PHP for example)?

  • 写回答

2条回答 默认 最新

  • douying7289 2014-01-01 16:41
    关注

    All you have to do in this case is check the HTTPS status on your form page, and redirect to HTTP if necessary:

    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
        header('Location: http://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法