How to check a 301 redirect and the whole chain

A 301 redirect checker requests a URL without following it automatically, reads the status code and Location header, then repeats for each hop until a normal page answers. curl -sIL shows every hop for free in a terminal. Our Redirect Checker API returns each hop's status, Location, server and time, flags loops, temporary redirects and HTTPS downgrades, and costs $0.003 per URL.

Try it free Redirect Checker API — full chain, status codes, loops, $0.003 · $0.003 / call

301, 302, 307, 308: what search engines read

The common mistake is a site move done with 302s. Search engines may keep the old address in results because the move looks temporary.

CodeMeaningUse it when
301Moved permanentlyA page or domain has a new permanent address
308Permanent, keeps the request methodSame as 301, for forms or APIs that POST
302Found (temporary)Short-term moves, A/B tests, login bounces
307Temporary, keeps the methodTemporary moves for POST requests

Check it free with curl

Free web checkers such as httpstatus.io show the same thing in a browser. Remember that curl sends HEAD with -I; a few servers answer HEAD differently from GET.

curl -sIL -o /dev/null -w "%{http_code} %{url_effective}\n" http://example.com

# Every hop, with its status and Location:
curl -sIL http://example.com | grep -iE "^HTTP/|^location:"

Tracing it from code

Our API requests each hop once with GET and redirect handling turned off, up to 10 hops (set max_hops from 1 to 10). For each hop you get n, url, status, location, ms and server, and a kind of permanent or temporary. The notes call out chains of 3 or more, temporary redirects that should probably be 301 or 308, HTTPS-to-HTTP downgrades and sites that don't redirect HTTP to HTTPS at all. A loop sets loop to true and stops.

import requests

API = "https://iamai.markets/api/x402/services/PmEjvCtyYWd3"
r = pay_session.post(API, json={"url": "http://wikipedia.org"})   # $0.003 per URL
res = r.json()["result"]
for hop in res["hops"]:
    print(hop["n"], hop["status"], hop["url"], "->", hop.get("location"))
print("final:", res["final_status"], res["final_url"])
print(*res["notes"], sep="\n")

# pay_session: a requests session wrapped by your x402 v2 client (USDC on Base)

Things a redirect checker can miss

The product

Questions

How do I know a redirect is a 301 and not a 302?

Look at the status line of the first response, before it's followed. curl -I or a redirect checker shows it; a browser address bar doesn't.

How many redirects is too many?

Google follows up to 10 hops, but each one adds a round trip. Point links and the first redirect straight at the final URL.

Can I check a list of URLs?

Each API call traces one URL, so loop over your list. For a few dozen, a free bulk web checker is fine.

Related

Updated 2026-12-02