Using -l or --location one can follow redirects using cURL. Let’s understand it with a real-world example.
curl -L http://scrapingdog.com
- Initial URL was
http://scrapingdog.com. - Scrapingdog issues a
301redirect with theLocationheader pointing tohttps://scrapingdog.com. - Final URL is
https://scrapingdog.com.
If you need HTTP headers in the output then you can use -i option of cURL.
curl -L -i http://scrapingdog.com