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

URL 重写后, Location 跳转的疑问

  •  
  •   labchy · 2015-08-26 01:04:23 +08:00 · 1714 次点击
    这是一个创建于 3219 天前的主题,其中的信息可能已经有所发展或是发生改变。
    环境描述:
    一个公网 IP : 123.123.123.123
    两个网站,均为 PHP : http://www.A.com http://www.B.com
    通过使用 IIS7 的 URL 重写,将域名分别映射到内网地址: http://localhost:8001 http://localhost:8002
    重写规则就是简单的将域名重写为内网地址,保持{REQUEST_URI}
    问题描述:
    需求: http://www.A.com/p.php 页面需要通过 header ("Location: $url"); 跳转到别的网址,其中 $url=http://www.C.com/cgi-bin/v1.0/pay_gate.cgi?cmdno=1
    问题: Location 之后,网页没有跳转到 http://www.C.com/cgi-bin/v1.0/pay_gate.cgi?cmdno=1 而是跳转到 http://www.A.com/cgi-bin/v1.0/pay_gate.cgi?cmdno=1
    在内网访问 http://localhost:8001/p.php 则可以正常跳转 http://www.C.com/cgi-bin/v1.0/pay_gate.cgi?cmdno=1
    分析:查看 http://www.A.com/p.php Header 信息,发现如下内容
    Response Headers
    Content-Length:0
    Content-Type:text/html
    Date:Sat, 22 Aug 2015 14:14:15 GMT
    Keep-Alive:timeout=5, max=69
    Location:http://www.A.com/cgi-bin/v1.0/pay_gate.cgi?cmdno=1
    Server:Microsoft-IIS/7.5
    X-Powered-By:PHP/5.4.17
    X-Powered-By:ARR/2.5
    X-Powered-By:ASP.NET
    求助:请问有经验的同志指点一下,不胜感激~
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5644 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 01:47 · PVG 09:47 · LAX 18:47 · JFK 21:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.