gpt4 book ai didi

apache - ReSTLer ssl https 重定向

转载 作者:太空宇宙 更新时间:2023-11-03 13:01:40 25 4
gpt4 key购买 nike

我正在使用 reSTLer 编写 REST api,并且由于我不想进行一些基本身份验证,所以我需要将不是来自 https 的每个请求重定向到 https。

有没有人知道使用 reSTLer 提供的 .htaccess 文件执行此操作的方法,还是使用 php header 执行此重定向更好?

提前致谢!

最佳答案

对我有用的方法是从 index.php(网关)执行此操作,将下面的代码放在 index.php 中的任何其他代码之前

if($_SERVER['HTTPS']!="on")
{
$redirect= "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("Location:$redirect");
exit;
}

关于apache - ReSTLer ssl https 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12179891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com