This curl recipe shows you how to make curl always follow 301, 302, 303, or any other 3XX redirect. By default, curl doesn't follow redirects. To make it follow all redirects, use the -L command line option.

Follow Any Redirect

curl -L

This recipe uses the -L argument that forces curl to follow all possible redirects. In this recipe, curl is requesting but as this website has moved to https, it sends a 301 redirect response to Curl sees it, follows it, and fetches the https version of the website.

Created by Browserling

These curl recipes were written down by me and my team at Browserling. We use recipes like this every day to get things done and improve our product. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my curl recipe, then I love you, too! Use coupon code CURLLING to get a discount at my company.