I have bought a domain domain.com from GoDaddy. In GoDaddy, I have customised DigitalOcean as name servers; in DNS of DigitalOcean, I have added the following records:

A @ 178.62.x.y
CNAME sub domain.com
CNAME www.sub domain.com

As a result, when I type sub.domain.com and www.sub.domain.com in a browser, they both lead to sub.domain.com, which is what I want.

Currently domain.com and www.domain.com lead to the default site of my server. However, I also want them to lead to sub.domain.com.

Does anyone know what to do to make this happen?

Thank you

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

I don’t get your setup, because now you redirect sub.domain.com to domain.com and you want to redirect domain.com to sub.domain.com ?
But anyway, if you want domain.com to sub.domain.com just use a cname for it and it will work.
Name: domain.com
Hostname: sub.domain.com

  • The current setup does not redirect sub.domain.com to domain.com, it remains the same and this is what I want…

    I do want to redirect domain.com to sub.domain.com. If I add a CNAME (domain.com to sub.domain.com.), what should I do with regard to A record? Should I change the initial A record to one from sub.domain.com to 178.62.x.y?

    Thank you

Yes, just change your A record with the name sub.domain.com to 178.62.x.y
Then create the CNAME so domain.com will get redirected to sub. domain.com and that will redirected to your servers ip

  • Thanks for your help… Because it is hard to test (and the www thing), I would appreciate a full list of records to follow, so I have reformulated and posted a new question…