Follow Redirects with cURL

Is there a way to follow redirects with command line cURL?
Yes

$ curl -L pankajanupam.com

You need to add the -L or --location option to enable curl to follow HTTP redirects.

Curl 302 redirect not working (command line)
use option -L or --location

$ curl -L <url> 

Make PHP curl to follow redirects
use CURLOPT_FOLLOWLOCATION

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

Author: Pankaj Anupam

I am a Full Stack Web developer working in AngularJS, ReactJS, NodeJS, Javascript & PHP. I am using technologies like HTML5, CSS3, Sass, Bootstrap, D3, Grunt, Bower, CoffeeScript, MongoDB, Graph Database, Sql & Jade. I have hands-on experience of web & mobile optimized application development.


Leave a Reply

Your email address will not be published. Required fields are marked *