This question explains how to do it with
curl. The accepted answer also points out that
If wget is available, that would be far simpler.
I looked through
mam wget but the got lost in there, and didn't find an option to follow redirects.
wget follows redirects automatically. Just give the URL as an argument