How to follow redirects using Curl?

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