labchy
V2EX  ›  问与答

URL 重写后, Location 跳转的疑问

  •  
  •   labchy · Aug 26, 2015 · 2478 views
    This topic created in 3939 days ago, the information mentioned may be changed or developed.
    环境描述:
    一个公网 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
    求助:请问有经验的同志指点一下,不胜感激~
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3167 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:49 · PVG 20:49 · LAX 05:49 · JFK 08:49
    ♥ Do have faith in what you're doing.