Question

Setting up multiple domain aliases

I have five domain names, pointing to the same droplet . One domain is the primary one and the other four are just legacy aliases. There is also bunch of subdomains.

How do I set up the DNS system that any subdomain and legacy domain redirect correctly to the subdomain at the primary domain?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It seems there is no better way than putting wildcard domain redirection “* -> maindomain.com” in the DNS and then handling the requests by redirecting non-maindomain requests in nginx/apache conf. <br> <br>Putting a wildcard in the DNS causes the non-canonical domain names being used, thus you require a server-side redirect to canonical domain to make it “pretty”. This is not an optimal solution, but maybe one day DigitalOcean will provided us a DNAME DNS redirection.

Not sure how you could automate the process. The only way I can think of is outlined, here: <a href=“https://www.digitalocean.com/community/articles/how-to-set-up-a-host-name-with-digitalocean”>How To Set Up a Host Name with DigitalOcean</a>.