1. Using the -L
or --location
flag
According to manual: The -L
option will force curl
to retry the request on the new location if the server detects that the requested page has moved (marked with a Location: header and a 3XX response code).
To follow redirects use the command:
curl -L http://www.example.com
or
curl --location http://www.example.com
2. Limit the number of redirects --max-redirs
You are also able to limit the number of redirects using --max-redirs
parameter. By default, the limit is set to 50 redirects. To make unlimited redirections use -1
value.
Example command:
curl --max-redirs 5 -L https://example.com
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}