🎯 How It Actually Works
Think of it like an address system:
gov.lk (main domain)
└── moe.gov.lk (Ministry of Education)
└── ethaksalava.moe.gov.lk (e-Thaksalawa platform)
└── cdn.ethaksalava.moe.gov.lk (CDN server)
Each level is just another DNS record. That’s it. No special permissions needed.
⚙️ Key Features
- Unlimited depth – Technically up to 127 levels (but please don’t 😂)
- Easy setup – Just add DNS records in your domain provider
- Free – Domain එකක් තියෙනවා නම්, unlimited subdomains
- Organizational – Clean way to structure your infrastructure
- SSL compatible – Wildcard certificates cover multiple levels
💡 Why This Is Important
If you’re building anything beyond a basic website, subdomains are essential:
- 🚀 SaaS apps →
client1.app.yourdomain.com,client2.app.yourdomain.com - 📦 CDN setup →
cdn.yourdomain.comfor faster content delivery - 🔧 Environments →
dev.yourdomain.com,staging.yourdomain.com,prod.yourdomain.com - 🌍 APIs →
api.yourdomain.com,v2.api.yourdomain.com
Knowing this makes you look way more professional to clients. It’s that infrastructure-level knowledge that separates amateurs from pros. 💯
🛠️ How to Set It Up
Go to your DNS provider (Cloudflare, Namecheap, etc.) and add records like this:
Type Name Value
A imrishmika.site 203.0.113.1
A cdn.imrishmika.site 203.0.113.2
A edge.cdn.imrishmika.site 203.0.113.3
Or use CNAME for aliasing:
Type Name Value
CNAME cdn imrishmika.site
CNAME edge.cdn cdn.imrishmika.site
Wait පැයක් විතර for DNS propagation... then boom! ✅ Your multi-level subdomains are live.
💭 My Take
Honestly, the fact that DNS can handle infinite nesting is both powerful and dangerous. It’s powerful because you get insane flexibility. It’s dangerous because some devs go overboard and end up with stuff like:
api.v2.staging.internal.backup.legacy.oldapp.com 😭
What I actually respect about the gov.lk setup is its logical hierarchy — each level actually means something: ministry → department → service → infrastructure. That’s clean architecture right there. 🧩
For your own projects: keep it simple — 2 or 3 levels max unless you genuinely need more.
- ✅
cdn.yourdomain.com→ perfect - ✅
edge.cdn.yourdomain.com→ still fine - ❌
node5.edge.cdn.backend.v2.yourdomain.com→ bro chill 💀
The real power is understanding that subdomains aren’t magic — they’re just DNS records pointing to different IPs or services. Once you get that, you realize how much control you actually have. 🔥
💬 Your domain = your digital real estate. Subdomains = free floors you can build on top. Use them wisely, build them smartly! 🏗️