Har*_*iec 2 https location header http
我如何正确使用头功能,所以
header("location: http://".$_SERVER['HTTP_HOST']."/?para=abc"); //for http
Run Code Online (Sandbox Code Playgroud)
和
header("location: https://".$_SERVER['HTTP_HOST']."/?para=abc"); //for https
Run Code Online (Sandbox Code Playgroud)
如果可能,可以用1个字符串写?
.htaccess文件将把所有的http页面重定向到https没有问题,但我相信使用适当的http/https页面语法是有意义的header("location:...)
,所以它适用于所有浏览器.
use*_*209 10
您还可以使用以下代码:
header("Location: //www.google.com");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19055 次 |
最近记录: |