Make domain url lead to subdomain

August 20, 2015 4.5k views
Nginx DNS

I have bought a domain 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 www.sub

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

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

Does anyone know what to do to make this happen?

Thank you

2 Answers

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

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

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

    Thank you

Yes, just change your A record with the name to 178.62.x.y
Then create the CNAME so will get redirected to sub. 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…

Have another answer? Share your knowledge.