Get final URL after curl is redirected

前端 未结 11 1944
清酒与你
清酒与你 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 08:02

    This would work:

     curl -I somesite.com | perl -n -e '/^Location: (.*)$/ && print "$1\n"'
    

提交回复
热议问题