V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
terence4444
V2EX  ›  问与答

一个神奇的 HTTP 跳转:访问域名自动 302 到某个目录内,但点击回"/"却不会再跳转,这是如何实现的?

  •  
  •   terence4444 · 2016-12-09 22:08:09 +08:00 · 2714 次点击
    这是一个创建于 2703 天前的主题,其中的信息可能已经有所发展或是发生改变。
    例子: https://www.humblebundle.com/
    现在进入站点后会自动 302 到 https://www.humblebundle.com/books/neil-gaiman-book-bundle
    现在如果:
    1. 点击 Game Bundles ,页面上显示的 a href = "/",会先重定向到 https://www.humblebundle.com/ 然后再跳转到 https://www.humblebundle.com/tycoon-simulator-bundle
    2. 再次在浏览器地址栏中输入 https://www.humblebundle.com/,还是被重定向到 https://www.humblebundle.com/books/neil-gaiman-book-bundle

    请问,这种访问同一个地址跳转到不同目录是如何实现的?
    5 条回复    2016-12-09 23:29:31 +08:00
    lhbc
        1
    lhbc  
       2016-12-09 22:10:56 +08:00 via Android   ❤️ 1
    referrer
    sciooga
        2
    sciooga  
       2016-12-09 22:15:21 +08:00   ❤️ 1
    @lhbc 是 Referer 不是 Referrer ,相信你懂的。
    a67793581
        3
    a67793581  
       2016-12-09 22:16:17 +08:00
    终结~······
    terence4444
        4
    terence4444  
    OP
       2016-12-09 22:20:55 +08:00
    @lhbc
    @sciooga

    果然是,我在 HTTP 头里伪造了一个 'Referer',="https://www.humblebundle.com/" 就跳转到 1 的地方去了。
    非常感谢。
    lhbc
        5
    lhbc  
       2016-12-09 23:29:31 +08:00 via Android   ❤️ 1
    @sciooga 一开始拼错成 referer 了,现在两个好像都可以用的?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   816 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:47 · PVG 06:47 · LAX 15:47 · JFK 18:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.