Check website redirect header
If given a link that is suspect, or troubleshooting behavior of a website that is having trouble doing a redirect, check the HTTP header for a redirect. Curl does this with the –head option.
curl --head example.invalid
This will return the HTTP header, which will show if there is a redirect, and where it is redirecting to.
HTTP/2 301
...
Location: https://www.example.invalid
Some web servers behave differently to a HEAD request than a GET request. To see the behavior of a GET request, use the –location option to follow redirects.
curl --location --silent --dump-header - -o /dev/null example.invalid
--silent
- suppresses the progress bar
--dump-header -
- dumps the header to standard out
-o /dev/null
- discards the body