How to follow redirects using Curl?

To follow redirects with Curl, you need to use the -L or --location command-line option. The server indicates that the resource has moved to a new location using the 3XX response code and provides the new address using the Location HTTP header. By default, Curl does not follow redirects and displays the content of the 300x page (if any). In this Curl Follow Redirects example, we send a request to www.reqbin.com, which redirects to reqbin.com. Click Run to execute the Curl Redirect example online and see the results.
Loading...