What I wanted was https://kennyfraser.com to be the definitive URL of this site, and https://www.kennyfraser.com to redirect there.

Using the instructions here I had to add a CNAME file to my GitHub User repository as well as configure a CNAME record at the DNS service provider (Fasthosts).

The GitHub CNAME file contents are just:

kennyfraser.com

Don’t make this mistake in the DNS provider’s CNAME records:

CNAME records at Fasthosts

Using a blank hostname in the CNAME records can mess up the MX routing for email, and possibly other services.

The www Host Name CNAME record points to my username.github.io. This is the recommended custom subdomain for best performance.

Two A Records for the apex (non-www) domain with Github IP addresses are also necessary. GitHub Pages automatically creates a redirect between the www and non-www versions of the domain, depending on the contents of the CNAME file.