Use curl -L so it will follow redirects.