LovableHTML is nowEncited.com
·Read the announcement →
encited logo
BlogAPI PlatformPricing

Set a primary domain (apex vs www redirect)

Pick a single canonical host (apex or www) and redirect the other one with a 301 — so search engines and AI crawlers index one URL, not two.

What this setting does

Browsers happily serve example.com and www.example.com as two different hostnames. To search engines and AI crawlers, that's two copies of every page — which splits ranking signals and dilutes backlinks across both versions.

The Primary domain setting picks one host as canonical and 301-redirects the other to it. The redirect happens at the edge before the page renders, so crawlers always end up on the canonical host.

Where to configure it

  1. Go to Site Settings
  2. Under CACHE & ROUTING, find Primary domain
  3. Pick one of three options

The three options

example.com (apex)www.example.com requests are 301-redirected to example.com. Choose this if you want shorter URLs and don't need to put the site on a CDN that requires a CNAME at the root (apex CNAME flattening is supported by Cloudflare and a few others, but not all DNS providers).

www.example.comexample.com requests are 301-redirected to www.example.com. Choose this if your DNS provider doesn't support apex CNAME flattening, or if you need cookie isolation (cookies set on www. won't leak to other subdomains like app.example.com).

Off — Both hosts serve content. Don't use this in production. Search engines will see two indexable copies of your site.

Either apex or www works for SEO — Google treats both as valid canonical choices. Pick one and stick with it. Switching later forces re-crawling and temporary ranking dips.

How the redirect actually works

When a request hits the non-canonical host:

  1. Encited (formerly LovableHTML) responds with 301 Moved Permanently
  2. The Location header points to the same path on the canonical host
  3. Query strings and the path are preserved exactly

So https://www.example.com/blog/post?ref=twitterhttps://example.com/blog/post?ref=twitter if apex is canonical.

Verify it's working

bash
CopyDownload
curl -sI https://www.example.com/some-page
# Expect:
# HTTP/2 301
# location: https://example.com/some-page

Don't combine this with a page-level redirect that also rewrites the host — they'll fight each other and cause redirect loops. Use the Primary domain setting for the apex/www choice, and use 301 redirects only for path-level forwards.

Common mistakes

  • Setting both DNS records but no primary — both versions resolve, both get indexed, ranking gets diluted.
  • Switching primary host mid-launch — every existing backlink and cached search result now goes through one extra redirect hop. Pick the canonical host before you start building inbound links.
  • Forgetting to update sitemaps — your sitemap should list the canonical host. If it lists the non-canonical one, every URL in it is a redirect.
Avatar
How can we help?
Get instant answers to your questions or leave a message for an engineer will reach out
Ask AI about LovableHTML
See our docs
Contact support
Leave a message
We'll get back to you soon
Avatar
Ask AI about LovableHTML
Team is also here to help
Thinking
Preview
Powered by ReplyMaven
Avatar
Aki
Hi, need help with SEO, AI search or getting indexed?