Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

2  
Wget does this automatically. –  mailq Nov 28 '11 at 20:37

1 Answer 1

curl -L http://domain.com

-L/--location
(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

 
discard

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