Can someone provide guidance on how to redirect traffic from apex/root domain to a www subdomain using Appwrite Sites as the DNS manager. What I've done so far:
- Changed the domain registrars nameservers to point at appwrite servers
- Created custom apex domain, verified, and targeting active deployment
- Created the www subdomain targeting the active deployment
- Created a DNS ALIAS record for apex domain pointing at www subdomain
The current configuration allows visitors to see/use both the apex and www subdomain. I would like all traffic following the apex domain to land on the www subdomain but can't find anyway of changing the target from "Active deployment" to "Redirect". Do I have to delete the apex domain from Appwrite Sites Console and re-create as a redirect? Does this cause issues/errors/downtime I should account for?
I can help with this. What’s happening is that Appwrite treats your apex and www as two separate domains pointing to the same deployment, so it serves both instead of redirecting. The DNS ALIAS you added only helps resolve the domain it doesn’t force a redirect. Appwrite Sites doesn’t currently support setting a domain as a redirect in the dashboard, so even if you remove and re-add the apex, it will still behave the same way if it points to a deployment. The fix is to handle the redirect outside DNS either inside your app (like a simple redirect rule) or through a proxy like Cloudflare. That’s what will actually force users from apex → www. What are you deploying static site or something like Next.js?
Ah thank you, that's great context! I use Namecheap as the domain registrar and I'm deploying a react native SPA using expo web build. Do you know how the Appwrite Sites "Domain rule types" work (active deployment, git branch and redirect), and why a "redirect rule" wouldn't work in this scenario? I'll explore your suggested alternatives, I was just hoping I wouldn't have to configure/manage another service to achieve the redirect. Cheers!
Yeah that makes sense. The “redirect rule” in Appwrite won’t work here because it doesn’t handle domain-level redirects like apex → www, only path-based ones. Since your apex is linked to an active deployment, Appwrite will always serve it instead of redirecting. You don’t need anything complex, just a small external redirect setup to force it properly. If you want, I can quickly set this up for you cleanly with no downtime 👍
Appreciate the offer! I'm going to have a look at options. If it's too annoying for me, I'll reach out.
Yes, try recreating the custom domain under your site
Recommended threads
- Static IP for security purpose!
Hey I am hosting a next.js project in appwrite it reaches out to mongo DB to fetch data The only option to enable network access to 0.0.0.0/0 in mongo DB (any ...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...
- Sydney Cloud Sites: App Git deployment a...
Project ID: rentwize-db The app Site fails after the build completes with a missing build archive error. Site id: app Framework: TanStack Start SSR Output dir...