有一个网站,当您访问某些链接时,会将您redirect到另一个网站。
有没有什么办法可以find什么HTTP代码返回之前,他们redirect你?
当然,试试curl:
$ curl -k https://www.gmail.com/ <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1>
curl , wget ,…和其他命令行web浏览器可能不可用于所有操作系统,只需使用telnet :
$ telnet localhost 81 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /one/two?path=x&y=z HTTP/1.0 <enter> <enter> HTTP/1.1 301 Moved Permanently Server: nginx/1.0.5 Date: Sat, 15 Oct 2011 02:38:59 GMT Content-Type: text/html Content-Length: 184 Location: http://127.0.0.1:81/one/two/x?y=z Connection: close
您也可以传递Host头:
telnet www.ganglia.gentoo 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / HTTP/1.0 Host: www.ganglia.gentoo <enter> <enter> HTTP/1.1 301 Moved Permanently Date: Sat, 15 Oct 2011 02:45:41 GMT Server: Apache Location: http://nagios.gentoo/ Content-Length: 297 Connection: close Content-Type: text/html; charset=iso-8859-1