Setting up multiple domain aliases

  • Posted January 10, 2014

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
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

It seems there is no better way than putting wildcard domain redirection “* ->” 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=“”>How To Set Up a Host Name with DigitalOcean</a>.

To clarify further, I’d like a solution that doesn’t require me to duplicate all the subdomain data for all the domains by hand. Keeping say 10 subdomains over 5 domains is 50 steps and prone to errors in the long run.

Yes, partially it is. Yet, if the domain names and subdomains are not configured correctly, the request will never get to the web server. Thus, original question stands.

that’s not DNS, it’s apache/nginx.