How can I ensure that both mywebsite.com and www.mywebsite.com work correctly?

I can't enter my webpage url using mywebsite.com but www.mywebsite.com works. I also think I might have deleted DNS records since I only have CNAME name: www target: mywebsite.pages.dev. I suspect the issue lies here.
4 Replies
Dubz
Dubz2mo ago
Add a second CNAME using @ (or mywebsite.com, they do the same thing) as the name and mywebsite.pages.dev as the content.
The Doomfire
The DoomfireOP2mo ago
I added it hope it works! I do however get a popup "CNAME records normally can not be on the zone apex. We use CNAME flattening to make it possible."
Chaika
Chaika2mo ago
You need to add any Pages Custom Domains that you want to work, under your Pages Project -> Custom Domains tab (it'll make the record for you too). Otherwise just adding the record alone won't work. Alternatively you could reidrect from apex -> www
The Doomfire
The DoomfireOP2mo ago
Thanks that did it! I had already added www.mywebsite.com but also added mywebsite.com too as a custom domain and now it works perfectly!

Did you find this page helpful?