Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from serverfault.com Nov 28 '11 at 20:38

This question came from our site for system and network administrators.

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.