首页 文章

使用网址重定向下载文件

提问于
浏览
9

我可以通过url下载文件但是当我从bash尝试它时,我得到一个html页面而不是文件 .

如何使用curl,wget或其他方式下载带有url重定向的文件(301 Moved Permanently)?

UPD

来自网址请求的标头 .

curl -I http://www.somesite.com/data/file/file.rar

HTTP/1.1 301 Moved Permanently
Date: Sat, 07 Dec 2013 10:15:28 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3
Location: http://www.somesite.com/files/html/archive.html
Vary: Accept-Encoding
Content-Type: text/html
X-Pad: avoid browser bug

1 回答

  • 8

    使用 -L, --location 来关注重定向:

    $ curl -L http://httpbin.org/redirect/1
    

相关问题