I am trying to download the contents of http://someurl.com/123
using wget
. The problem is that http://someurl.com/123
is redirected to http://someurl.com/456
.
I already tried using --max-redirect 0
and this is my result:
wget --max-redirect 0 http://someurl/123
...
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://someurl.com/456 [following]
0 redirections exceeded.
Is there a way to get the actual contents of http://someurl.com/123
?
By default, wget
can follow up to 20 redirections. But since you set --max-redirect
to 0
, it returned 0 redirections exceeded
.
Try this command
wget --content-disposition http://someurl.com/123
--max-redirect=number
Specifies the maximum number of redirections to follow for a resource. The default is 20, which is usually far more than necessary. However, on those occasions where you want to allow more (or fewer), this is the option to use.
--content-disposition If this is set to on, experimental (not fully-functional) support for Content-Disposition headers is enabled. This can currently result in extra round-trips to the server for a HEAD request, and is known to suffer from a few bugs, which is why it is not currently enabled by default.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.