Skip to content
Every tutorial here is 100% free — and always will be
LSLovableStudent

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

  1. In Project settings → Domains, add both mydomain.com and www.mydomain.com.
  2. Add the DNS records Lovable shows for each — typically an A record for the root and a CNAME for www.
  3. 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 www CNAME 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

Website made, maintained and hosted by PromptSites.com

PromptSites logo