↑ ↓ select, Enter open, Esc close

Test http, https, www and non-www at once

Adjust the values, the command updates live
user@server
for u in http://example.com/ http://www.example.com/ https://example.com/ https://www.example.com/; do curl -s -o /dev/null -m 10 -w "%{http_code}  $u -> %{redirect_url}\n" "$u"; done

Requests the homepage in all four combinations. Correct is exactly one variant with 200, while the other three redirect directly to it with 301. If several variants answer with 200, duplicate content is created and signals are split across multiple URLs.

Note: Status 000 usually means there is no DNS record or no valid certificate for that variant. The entry on redirect count and final target shows redirects that go through an intermediate step.

Also searched as

  • check www and non-www redirect
  • test http to https redirect
  • duplicate content www vs non-www
  • check all domain variants redirect

Related one-liners

All in SEO checks

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.