↑ ↓ select, Enter open, Esc close

Show the redirect chain of a URL with status codes

Adjust the values, the command updates live
user@server
curl -sIL "http://example.com/" | grep -iE "^(HTTP/|location:)"

Sends HEAD requests, follows every redirect with -L and filters out the status lines and Location headers. This shows at a glance whether a redirect is permanent (301, 308) or temporary (302, 307) and how many hops it takes to reach the target. For search engines, the canonical address should be reachable with exactly one 301 redirect, chains like http to https to www waste crawl budget and load time.

Note: Some applications respond differently to HEAD than to GET. If in doubt, replace -I with -o /dev/null -D -.

Also searched as

  • check 301 or 302 redirect
  • show redirect chain command line
  • test http to https redirect
  • check www redirect curl

Related one-liners

All in Apache

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.