【问题标题】:Restler ssl https redirectionRestler ssl https 重定向
【发布时间】:2012-08-29 14:09:59
【问题描述】:

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

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

提前致谢!

【问题讨论】:

    标签: apache authentication ssl https restler


    【解决方案1】:

    对我有用的方法是从 index.php(网关)开始,将下面的代码放在 index.php 中,然后放在任何其他代码之前

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

    【讨论】:

      猜你喜欢
      • 2017-03-26
      • 2016-01-26
      • 2013-06-10
      • 1970-01-01
      • 2012-10-25
      • 2015-01-01
      • 1970-01-01
      • 2012-07-30
      • 2017-04-14
      相关资源
      最近更新 更多