Subdomains through Freenom with Github

0

I want to have page.mydomain.tk redirect to mydomain.tk/page. I've tried setting a new record as

Name: page A, TTL 3600, Target: <IP>

but this redirects to mydomain.tk I've also tried

Name: page CNAME, TTL 3600, Target: mydomain.tk/page but it results in

Error occured: Invalid name in dnsrecord

Thanks in advance for any tips.

Infinitus

Posted 2019-11-05T05:06:47.137

Reputation: 3

Answers

0

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.

user1686

Posted 2019-11-05T05:06:47.137

Reputation: 283 655

Thanks, this makes much more sense! – Infinitus – 2019-11-05T06:01:27.563