首页 > 编程知识 正文

域名301重定向教程,域名跳转

时间:2023-05-04 07:48:29 阅读:140819 作者:2706

输入主域名,自动跳转到www域名下。 代码如下。

$ the _ host=$ _ server [ ' http _ host ' ]; //获取当前域名$ the _ URL=isset ($ _ server [ ' request _ uri ' ] )? $_SERVER['REQUEST_URI'] : '; //判定地址后面的部分$the_URL=strtolower($the_URL ); //是否将英文字符转换为小写if ({ $the_URL=)/index.PHP )|{ $the_url=(/index.html ) ) /首页) $ the _ URL=' ) //301头部标题(location 33603358 www.* * *.com); 跳转到带有//www的URLexit; (if ) $the_host=='**.com ' ) /如果域名是没有www的网站,则进行下一个301跳转) header ) ) http/1.1301movedpermanently ); //301只头(location 33603358 www.* * *.com (.$ the _ URL ) ); 跳转到带有//www的URLexit; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。