For this site I wanted:
https://newcombe.dev
to be the canonical address while still allowing visitors to type:
https://www.newcombe.dev
The result is a permanent redirect:
www.newcombe.dev
↓
HTTP 301
↓
newcombe.dev
A useful test from PowerShell is:
curl.exe -I https://www.newcombe.dev
The important response is:
HTTP/1.1 301 Moved Permanently
Location: https://newcombe.dev/
I also test a path rather than only the homepage:
curl.exe -I https://www.newcombe.dev/about/
and check that it becomes:
Location: https://newcombe.dev/about/
That confirms the redirect is preserving the requested path rather than sending everything to the homepage.
Why bother?
Using one canonical hostname keeps links consistent and avoids maintaining two public versions of the same site.