wget: don't follow redirects
--max-redirect 0
I haven't tried this, it will either allow none or allow infinite..
Use curl
without -L
instead of wget
. Omitting that option when using curl
prevents the redirect from being followed.
If you use curl -I <URL>
then you'll get the headers instead of the redirect HTML.
If you use curl -IL <URL>
then you'll get the headers for the URL, plus those for the URL you're redirected to.
Some versions of wget
have a --max-redirect
option: See here