收藏文章 楼主

cms 301 转跳https

版块:疑难   类型:普通   作者:小绿叶技术博客   查看:981   回复:1   获赞:0   时间:2021-11-07 16:04:23

// https转跳

$the_host = $_SERVER['HTTP_HOST'];//取得当前域名

if(strtolower($the_host) != 'test.com')//把这里的域名换上你想要的

{

    $URIRedirect=$_SERVER['REQUEST_URI']; //获取域名后的参数

    if(strtolower($URIRedirect)=="/index.php")//判断是参数为/index.php就显示为/

    {

    $URIRedirect="/";

    }

    header("HTTP/1.1 301 Moved Permanently");//发出301头部

    header("Location: http://www.test.com" . $URIRedirect);//跳转到你希望的地址格式

    exit();

}


提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:cms 301 转跳https

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息