loading...
Cover image for 🔥 Wildcard Subdomains & GitHub Pages

🔥 Wildcard Subdomains & GitHub Pages

ctrleffive profile image Chandu J S Updated on ・2 min read

I'm using GitHub as a hosting platform for my website. And my domain chandujs.dev is managed in Cloudflare. I wrote an article about how/why I migrated from Netlify to GitHub. Read it here.

I have some projects hosted in the GitHub pages (github.io domain). I wanted to add subdomains for those projects so it looks like a part of my website. 😉

But I have to manually create subdomains and assign them to GitHub pages. When more and more projects come, I have do update DNS every time. Plus, my DNS records list will look messy.

I researched a bit and found out that I can add wildcards subdomains. Since my domain's A records are pointed to GitHub's IP addresses, I just had to add a CNAME with the name * points to chandujs.dev. If your A records are pointed to another server, you can add a CNAME with name * points to YOUR_GITHUB_USERNAME.github.io.

This is how my DNS records list looks like.

DNS

And that's it!

From now on I can simply set the custom domain in my projects and the website is ready.

GitHub

BONUS ⭐️
I'm using a service called improvmx to catch all emails that coming to *@chandujs.dev. Emails will be forwarded to my work email.

Posted on Apr 5 by:

ctrleffive profile

Chandu J S

@ctrleffive

💻 Full Stack Developer • Photographer • Freelancer 🇮🇳 Indian • Code • Music • Coffee ☕️

Discussion

markdown guide