我正在我的本地主机上使用curltestingredirect。 当我运行这个命令时:
$curl "test.test.com/landing/0192"
我得到这个输出:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>302 Found</title> </head><body> <h1>Found</h1> <p>The document has moved <a href="http://redirect.redirect.com/landing?xid=0192&tt=192">here</a>.</p> <hr> <address>Apache/2.2.17 (Fedora) Server at spencervm.adverplex.com Port 80</address> </body></html>
现在,如果我运行http://redirect.redirect.com/landing?xid=0192&tt=192"我到达了我想要的目的地,所以基本上我想要做的就是closures302错误并redirect到它的页面应该redirect到。
curl默认不遵循redirect,但这不是你的web服务器的问题; HTTP客户端负责实现redirect响应的处理。
添加-L标志:
curl -L "test.test.com/landing/0192"