Use curl
without -L
instead of wget
. Omitting that option when using curl
prevents the redirect from being followed.
If you use curl -I
then you'll get the headers instead of the redirect HTML.
If you use curl -IL
then you'll get the headers for the URL, plus those for the URL you're redirected to.