PHP - 头重定向不在ssl下工作

时间:2016-08-02 08:10:17

标签: php redirect

我有简单的PHP代码:

<?php
    /* Redirect browser */

    $url = urldecode($_GET['redirect']);

    if (empty($url)) { 
        echo "no url";
    } else {
        header("Location: $url");
    }

    /* Make sure that code below does not get executed when we redirect. */

    exit;
?>  

当我输入:

http://domain.com/r.php?redirect=https%3A%2F%2Fwww.google.pl

我被重定向到谷歌。但是当我通过https:

访问网址时
https://domain.com/r.php?redirect=https%3A%2F%2Fwww.google.pl

我被重定向到域根,f.e domain.com。其他一切都可以正常使用https。

有什么问题?

编辑:似乎重定向到相对网址的工作正常 - 只有通过https的网址会导致问题。

0 个答案:

没有答案