PHP单页强制HTTP跳转HTTPS
分类:教程分享 评论:0条 阅读:955次

PHP单页强制HTTP跳转HTTPS

分类:教程分享 评论:0条 阅读:955次

在需要强制跳转的页面添加以下代码:

//HTTP强制跳转HTTPS
if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off'){
    Header("HTTP/1.1 301 Moved Permanently");
    header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}

预览:

400194919.jpg

评论区
icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif