我一直听到301重定向的消息。这和这样做是一样的吗?:
<?php
header("Location: https://www.example.com/");
exit();
?>这样做和以不同的方式重定向有什么不同?提前谢谢。
发布于 2021-02-11 23:41:02
根据文档(https://www.php.net/manual/en/function.header.php)标头(‘Location:...')返回的状态代码为302,表示“已临时移动”。如果您想要告诉浏览器这是一个永久重定向,请使用301状态代码,如下所示:
header("Location: https://www.example.com/", true, 301);https://stackoverflow.com/questions/66157364
复制相似问题