DNS CNAMEs are not web redirects – they are only "A record" redirects. Therefore they can only point to another domain name, and not to a full URL, as CNAME translation happens entirely outside of the HTTP request.
When you have several different domains pointing to the same server (regardless of whether you do that through CNAMEs or through A/AAAA records), it is up to the server to recognize that it's being called under two different names, and translate the received URLs accordingly.
(Most webservers call this feature "name-based virtual hosts" or "vhosts" for short.)
If you're hosting your website on GitHub Pages, you should be able to achieve this by having two separate repositories – one with mydomain.tk
in the repository's CNAME
file, and the other with page.mydomain.tk
in the repo's CNAME
file.
Thanks, this makes much more sense! – Infinitus – 2019-11-05T06:01:27.563