How do I connect www and non-www versions?
Last checked 31 Aug 2026
Short answer
Add DNS records for both the root domain and the `www` subdomain in Lovable's Domains panel, then choose one as your primary — Lovable typically redirects the other to it automatically.
Why you need both
Visitors type domains inconsistently — some go straight to mydomain.com, others to www.mydomain.com. If you only connect one, the other either won't resolve or will 404 even though DNS looks fine (see why-does-my-domain-show-a-404-or-403-error).
Steps
- In Project settings → Domains, add both
mydomain.comandwww.mydomain.com. - Add the DNS records Lovable shows for each — typically an A record for the root and a CNAME for
www. - Choose which one is your primary domain (see how-do-i-choose-my-primary-domain); Lovable generally redirects the non-primary version to it, so visitors always land on a single canonical URL.
Connect both mydomain.com and www.mydomain.com, and make mydomain.com (no www) the primary, redirecting www to it.
Why a single canonical version matters
Having both versions live without a redirect can split search engine indexing and confuse analytics — one canonical URL is better for SEO and consistency.
What usually goes wrong
- Adding only the
wwwCNAME and assuming the root domain will "just work" — it needs its own A record. - Setting up both but not choosing a primary, so visitors bounce between two versions with no redirect.
- DNS records for one variant added in the wrong panel (see why-isn-t-my-custom-domain-connecting if either version won't resolve).
Sources
Was this answer helpful?
Related questions
- AnswerHow do I publish a Lovable website?Click Publish in the top-right of the Lovable editor; it deploys your current version to a live `*.lovable.app` URL (or your connected custom domain) in under a minute.
- AnswerHow do I change the favicon?Ask Lovable in chat to update the favicon, and upload or link the image you want — Lovable will swap the icon file and reference it in the page head for you.
- AnswerHow do I change the social sharing image?Ask Lovable to update the Open Graph image, or edit the og:image meta tag in your page head and upload the image asset — this controls the preview card shown when your link is shared on social platforms.
- AnswerWhat DNS records does Lovable need?Lovable shows the exact records to add when you connect a domain — typically an A record for the root/apex domain and a CNAME for `www` (or a subdomain), plus any verification record it asks for.