douan6931 2018-05-24 04:46
浏览 73
已采纳

通过使用https读取子域WHILE进行转发的PHP脚本

I've got a php script that forwards the user based on what subdomain the wrote in the url.

Now, normally you would read the HTTP_URI, but my webhost are using iframe, so I have to read the HTTP_REFERRER.

now to the problem, when accessing the site "normal", like mysite.com or

http://example.com

it works fine, however, when using https, it only shows a white page.

This is my code:

<?PHP

$REFERRER = $_SERVER['HTTP_REFERER'];

// Or other method to get a URL for decomposition 
$domain = substr($REFERRER, strpos($REFERRER, '://')+3); 
$domain = substr($domain, 0, strpos($domain, '/')); 
// This line will return 'en' of 'en.example.com' 
$subdomain = substr($domain, 0, strpos($domain, '.')); 
//Echo $subdomain;

header("Location: https://example2.com/'$subdomain");
?>

.. Anybody got any suggestions? Rewriting doesn't work on subdomains on this server.

  • 写回答

2条回答 默认 最新

  • dphe5602 2018-05-24 08:52
    关注

    As discussed in the comments the problem is "blocked loading mixed active content".

    An iframe or its contents can not be loaded over http if the site containing the iframe is loaded via https.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 这个公式写进SIMULINK中的function模块的代码中应该是什么样的
  • ¥15 javaweb登陆的网页为什么不能正确连接查询数据库
  • ¥15 数学建模数学建模需要
  • ¥15 已知许多点位,想通过高斯分布来随机选择固定数量的点位怎么改
  • ¥20 nao机器人语音识别问题
  • ¥15 怎么生成确定数目的泊松点过程
  • ¥15 layui数据表格多次重载的数据覆盖问题
  • ¥15 python点云生成mesh精度不够怎么办
  • ¥15 QT C++ 鼠标键盘通信
  • ¥15 改进Yolov8时添加的注意力模块在task.py里检测不到