I want to visit an URL in CentOS and then automatically follow the redirects. So, for example:

Visit http://domain.com
This will redirect my by a `header()` to another webpage, so automatically follow this redirect.
And this page will also redirect me.
Save the contents on the `landing` page.

How do I accomplish this?

  • 2
    Wget does this automatically. – mailq Nov 28 '11 at 20:37
curl -L http://domain.com

(HTTP/HTTPS) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the request on the new place.

or wget http://domain.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy