In this article
A redirect is a server response, not necessarily a failed connection. The useful distinction is between receiving that response, following its instruction, and getting the content you actually wanted. Each is a separate observation.
Start with the built-in command
In Terminal, use /usr/bin/curl -q -L "https://example.com/", replacing the example address with the public URL you intend to check. -L is short for --location. The first-position -q skips curl’s default configuration file, making this diagnostic less dependent on local settings.
You do not need another networking app just to follow a normal HTTP redirect. The curl project’s redirect guide explains the default behavior and the extra request made when redirect following is enabled.
| Observation | What it establishes | What to check next |
|---|---|---|
| HTTP 301 with a Location header | The server points to another address | Follow the intended destination |
A final HTTP 200 after -L | The last server response was successful | Confirm it is the expected content |
A final HTTP 404 after -L | The redirect target was not found | Review the final address |
| curl exit code 0 | The transfer met curl’s current error rules | Read the HTTP status too |
| curl error 47 | The configured redirect limit was exceeded | Inspect the redirect chain |
These examples concern ordinary GET requests. Do not apply a GET troubleshooting recipe unchanged to a form submission or an authenticated API request.
Read where the redirect actually leads
For a compact diagnostic, discard the response body and print three separate results:
/usr/bin/curl -q -sS -L --max-redirs 5 --max-time 20 \
-o /dev/null \
-w 'status=%{http_code} redirects=%{num_redirects} final=%{url_effective}\n' \
'https://example.com/'
Replace the example URL. -sS suppresses the progress meter while retaining error messages. --max-redirs 5 bounds redirect following, and --max-time 20 bounds the transfer time in seconds. The printed status is the last HTTP response, the count is the number of redirects followed, and the effective URL is where curl ended.
To see the response headers as well, add -D - to that command. Keep -o /dev/null when you want the headers without a potentially long body. This still makes a GET request.
Using -I instead asks for HEAD. Some servers handle HEAD differently, so a HEAD result is not always a substitute for the GET you are investigating. See why curl -I can return 405 if that is the mismatch you actually have.

Screenshot: everything curl, captured November 28, 2026. Redirect following is an explicit curl option.
Our test: the same redirect, different commands
On November 28, 2026, we ran Apple’s /usr/bin/curl 8.7.1 on macOS 15.7.5, build 24G624 against a disposable HTTP server bound only to 127.0.0.1. The server recorded the actual request paths. No external website or account was involved.
One endpoint returned a 301 pointing to a second endpoint that returned 200. Another redirected to a missing page, and a third redirected back to itself. We kept proxy settings and local curl configuration out of this controlled loopback test.
| Test | Requests observed | Final HTTP status | curl exit code |
|---|---|---|---|
| Plain request to the 301 endpoint | Original path only | 301 | 0 |
Same request with -L | Original and target paths | 200 | 0 |
Redirect to a missing page with -L | Original and missing paths | 404 | 0 |
Same missing-page case with -L --fail | Original and missing paths | 404 | 22 |
Self-redirect with -L --max-redirs 3 | Four requests to the loop path | 302 | 47 |
The first two rows isolate the effect of -L: the server saw an additional request only when curl was instructed to follow. The next two show why an exit status by itself can mislead a script. The loop row shows that a limit of three followed redirects still allows the initial request plus those three follow-up requests.
This experiment verifies these HTTP behaviors in the stated environment. It does not test TLS certificates, browser cookies, authentication, or the behavior of every installed curl version.
A successful transfer can still end at an error page
Curl normally distinguishes a transfer failure from an HTTP response that happens to be an error. Receiving a complete 404 response can therefore produce exit code 0, as our test demonstrated.
For a check that should fail on HTTP error responses, the documented --fail option changes that behavior. It does not make 301 itself an error, and it does not establish that a 200 response contains the right page. A login page or a generic application screen can still be a successful HTTP response.
Check the final URL, HTTP status and expected content together. The curl manual documents --location, --fail, the redirect limit and the output variables used here; local man curl describes the version installed on your Mac.
Know where browser comparisons stop
A browser may have cookies, cached redirects, JavaScript and an authenticated session that this curl command does not have. Curl’s redirect option follows HTTP redirects; it does not turn curl into a browser that executes a page’s JavaScript navigation.
The HTTP semantics standard distinguishes redirect status codes and their method rules. In particular, POST handling can change across redirects. Avoid adding arbitrary -X method overrides just to make a result resemble a browser trace.
A redirect can also change hosts. Do not solve an ordinary 301 by adding --location-trusted, which changes credential forwarding, or by disabling certificate checks. If the remaining problem is a proxy difference, investigate curl and macOS system proxy settings separately.
For a practical result, preserve the original URL, final URL, HTTP status, redirect count and curl version. That record tells you whether you followed the move and what answered at the other end, instead of treating the first 301 or a lone zero exit code as the whole diagnosis.


