首页 > 怎么让部分页面是https的

怎么让部分页面是https的

php的网站
我想让其中一个页面走https 其他页面还是走http
CI的框架 现在是页面走了https 但是当我进https的页面后 在去别的页面的话 也都变成了https了

我想知道如何配置 网站就其中一个页面是https的 其他页面还是走http
我现在是直接用php判断跳转的
if ($_SERVER["HTTPS"] <> "on") {

$xredir = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
header("Location: " . $xredir);

}
O(∩_∩)O谢谢


比如说我希望/a/的走https,而/b/的走http

非ajax请求

在过滤器中解析url,符合a链接规则的且协议是http的则跳转到https,b同理

ajax请求

如果使用了jquery,可以这么干

    $(document).on('ajaxSend', function (xhr, options) {
        if (location.protocol.indexOf('https') > -1) {
            options.url = 'https://www.xxx.com' + options.url;
        }
    })

总之一句话,在某一处地方处理,方便维护。千万别在页面里写死链接

【热门文章】
【热门文章】