Pointing Subdomain to another Netlify Website

I am hoping someone can help us achieve the following:

  1. We have a website already hosted on Netlify, using Netlify DNS. Let’s call it: www.OURDOMAIN.com

  2. We want to now have a subdomain on that website called: admin.OURDOMAIN.com

  3. When then want to pont admin.OURDOMAIN.com to another website hosted at Netlify, called adminourdomain.netlify.app

How do we set this up? I assume we add the subdomain as a CNAME at www.OURDOMAIN.com DNS and point it to adminourdomain.netlify.app, but how do we set up the DNS at adminourdomain.netlify.app to recognize the subdomain call?

Hey @osseonews,
If we’re already hosting your DNS for ourdomain.com, you should be able to add admin.ourdomain.com as the primary domain of your second site, adminourdomain.netlify.app. I don’t think you’ll need a CNAME unless I’m misunderstanding?

For further troubleshooting, please share your actual domain so we can check your DNS config on our end and make sure all is well :slight_smile:

Thanks, but how can a subdomain be added as a primary domain for an entirely different application? This would imply that the DNS of a main domain (www.OURDOMAIN.com or OURDOMAIN.com) is an absolutely useless concept. You can’t register a subdomain of a primary domain that is already registered, or else a domain would be meaningless. I can just register social.facebook.com on netlify and start a new website to compete with facebook.com? Obviously, that’s impossible.

The idea of any subdomain is that it is managed via the DNS of the main domain, via. a CNAME or A Record on the main domain pointing to the subdomain application. So only someone with access to the DNS of a main domain can manage subdomains of the main domain. If you try to add a subdomain as a primary domain on another application, you are trying to manage the DNS of the main domain via the DNS of a subdomain and this is not allowed for obvious reasons, as pointed out above.

As an aside, the way subdomains worked when we hosted our own DNS is quite simple:
Step 1: We added a C record on the primary domain for the subdomain and the value of the C record was the URL or IP of the server where the application for the subdomain resided.
Step 2: Then on the server where we hosted the other application, a DNS entry was added to make the server recognize requests from the subdomain URL.

The problem with Netlify DNS is that Step 1 is easy to do, but Step 2 is seemingly not available, as there is seemingly no way to point any “website.netlify.app” to anything other than a primary domain that requires registration, and since you can’t register a subdomain as a separate website, from the primary domain, how is this managed?

Try it before you knock it :slight_smile: Our Director of Support offered the same advice previously.

OK, we’ll try it. But, it literally makes no sense, as it implies that we can create something like social.facebook.com and it will work perfectly fine, as long we make that the primary domain of the netlify app. If anyone can assign any subdomain as they please, and don’t have to change any DNS for any subdomain, then the entire domain system on the Internet would fall apart. Obviously, this wouldn’t work. You can’t just steal subdomains of primary domains and host a netlify app on it. A subdomain for any domain, must have a DNS entry in the main domain (either C or A), that points the subdomain correctly. That’s how DNS works.

BTW, we just tried this, and of course it doesn’t work, as expected. I would like to point out the obvious reason why the above suggestion does not work: When you try to register a subdomain as a primary custom domain for a Netlify app, Netlify requests that you point your nameservers for the subdomain to Netlify. This is of course impossible. A subdomain is not a domain and does NOT have its own nameservers. The nameservers are controlled by the domain, not the subdomain. A subdomain is just a C or A entry on the main domain DNS, and the domain already is pointed at Netlify, so how could you also point a non-existent subdomain nameserver at Netlify?

OK, we played around with the DNS a bit more and got a subdomain to work. However, the problem is that what happens when you add a subdomain to another Netlify app, when you host the domain with Netlify DNS is that Netlify automatically creates a “Netlify” system record in your DNS for the domain, pointing to the subdomain. The issue is that now it is impossible to edit the DNS entry for the subdomain, as when you attempt to do so you get the message: “* This is a system record that cannot be managed directly.” So there is no way to change where a subdomain is pointed to after you assign it one time. This makes it impossible to manage the subdomains, as we do need to change it in the future to point to a live app vs a development app. So how do we change the system record for the subdomain in a DNS to point it to the correct netlify app?

We can flip a switch backend to allow you to delete the record :+1: If you want to either reply with the domain(s) in question or PM me, I can get that sorted for you.

The reason we do this is to inhibit people from making use of Netlify DNS without hosting a site here – the DNS is an additional perk to hosting here, not the other way around :slight_smile: But we’re working on making this more seamless for y’all.