Get final URL after curl is redirected

前端 未结 11 1983
清酒与你
清酒与你 2020-12-04 07:38

I need to get the final URL after a page redirect preferably with curl or wget.

For example http://google.com may redirect to http://www.google.com

11条回答
  •  一个人的身影
    2020-12-04 07:47

    as another option:

    $ curl -i http://google.com
    HTTP/1.1 301 Moved Permanently
    Location: http://www.google.com/
    Content-Type: text/html; charset=UTF-8
    Date: Sat, 19 Jun 2010 04:15:10 GMT
    Expires: Mon, 19 Jul 2010 04:15:10 GMT
    Cache-Control: public, max-age=2592000
    Server: gws
    Content-Length: 219
    X-XSS-Protection: 1; mode=block
    
    
    301 Moved
    

    301 Moved

    The document has moved here.

    But it doesn't go past the first one.

提交回复
热议问题