drfqfuhej48511519 2011-06-19 16:45
浏览 7
已采纳

检测域名变更?

Is it possible to detect source of web forwarding?

For example, Domain A redirects to Domain B where Domain B has PHP hosting?

Basically I would like something like the following:

if ($was_redirected_from_domain_a) { ... }
  • 写回答

4条回答 默认 最新

  • douseda0009 2011-06-19 18:22
    关注

    As @MoarCodePlz and @Christopher Armstrong point out, $_SERVER["HTTP_REFERER"] is the solution.

    However, in your specific case, two redirects take place:

    http://fhc.quickmediasolutions.com/image/-1457172086.png

    This way, the original referrer info is lost. You will need to disable the second redirect, and run your PHP in my-art-gallery.co.uk's index page.

    Update after seeing the phpinfo() output:

    $_SERVER["HTTP_REFER"] is indeed completely non-existent.

    I suspect the culprit is this configuration setting:

    suhosin.server.strip = On 
    

    your hosting company is running the Suhosin PHP patch, which allows removing certain data from the PHP page for enhanced security. You may need to ask them to activate HTTP_REFERER.

    The only other way would be redirecting domain A to something like

    domainb.co.uk/index.php?camefrom=domainA
    

    You could then fetch the domainA argument through $_GET["camefrom"] - if the hosting provider's control panel allows that sort of redirection.

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

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP