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

user1592380 picture user1592380 · Aug 27, 2013 · Viewed 254.6k times · Source

I know that in a php script:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

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

Answer

Nathan Kuchta picture Nathan Kuchta · Aug 27, 2013

Use the location header flag:

curl -L <URL>