【发布时间】:2015-11-30 18:32:46
【问题描述】:
当 url 没有 https 或在 url 中有 www 时,我在 FB 应用程序上遇到错误。我只是要剥离 www 的 url。
如果 https 不在 url 中,下面的代码会添加 https,但 我将如何删除 www 以及?
if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == ""){
$redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $redirect");
}
【问题讨论】: