Subdomains & www redirects

Pick one canonical hostname across apex, www, or app subdomains, configure clean 301 redirects, remove conflicting DNS records, and verify HTTPS everywhere.

Choosing apex, www, or an app subdomain

Every live web application should treat one exact hostname as its canonical production origin. Serving live pages simultaneously on both https://example.com and https://www.example.com causes two immediate headaches.

Browsers isolate cookies, localStorage, and auth sessions per hostname, so someone signed in on example.com appears logged out on www.example.com. Search engines also split ranking signals and crawl budget across duplicate URLs.

Pick one primary format upfront based on whether ExaSpark powers your whole brand or runs alongside an existing website.

Hostname patternExample URLDNS recordBest suited for
Apex (root) domainhttps://example.comA on @Consumer apps, storefronts, booking sites, and primary brands
`www` subdomainhttps://www.example.comCNAME on wwwLegacy domains already indexed on www or strict enterprise DNS
App subdomainhttps://app.example.comCNAME on appSaaS portals, dashboards, or booking apps beside another homepage
Split site + appexample.com + app.example.comSeparate hostsExisting marketing CMS on root plus full-stack ExaSpark app

Custom domains require an active Starter ($4.99/mo or $3.99/mo billed annually) or Pro ($25/mo or $20/mo billed annually) plan and include automatic HTTPS certificates.

How canonical 301 redirects work

After picking your primary host—say https://example.com—every alternate combination (http://example.com, http://www.example.com, and https://www.example.com) should redirect permanently to that single canonical HTTPS origin.

  • Use `301` or `308` permanent redirects. Permanent status codes tell Google and browsers to consolidate ranking equity and bookmarks onto your primary host; temporary 302 redirects split signals.
  • Preserve paths and query strings. Redirecting https://www.example.com/pricing?utm_source=email must land on https://example.com/pricing?utm_source=email, never dump visitors onto the bare homepage.
  • Keep redirect chains to one or two hops. Extra hops slow cellular loads and risk dropping UTM or OAuth parameters.
http
HTTP/2 301
location: https://example.com/pricing?utm_source=newsletter
strict-transport-security: max-age=31536000
cache-control: public, max-age=3600

Connecting both apex and www cleanly

When your ExaSpark app owns the entire brand domain, verify your primary host first and ensure the alternate variant redirects over valid HTTPS.

  1. Bind your canonical host in ExaSpark

    Open Publish > Custom domain, enter your primary hostname (example.com or www.example.com), add the DNS records shown, and wait for active HTTPS status.

  2. Configure the alternate host

    Wire the secondary hostname (www or @) via ExaSpark's domain settings or an HTTPS-capable edge rule such as Cloudflare Redirect Rules.

  3. Prevent opposing redirect loops

    Never point ExaSpark in one direction (apex to www) while a registrar or Cloudflare rule redirects backward (www to apex).

  4. Align OAuth and Stripe callbacks

    Set Google OAuth redirect URIs, social logins, and Stripe webhooks strictly to your canonical host; see Authentication & roles and Testing Stripe & webhooks.

Separating marketing sites from app subdomains

Keeping a marketing homepage on example.com while running your ExaSpark product on app.example.com, portal.example.com, or book.example.com lets you iterate rapidly without touching root website DNS.

  • Root site and email stay untouched. Adding a CNAME record on app never alters root A, MX, SPF, or DKIM records.
  • Clean navigation handoff. Link homepage "Sign in" buttons to https://app.example.com/login and link the brand logo back to https://example.com or your dashboard home.
  • Consistent canonical origin. Ensure metadata, password-reset email links, and internal absolute URLs inside ExaSpark reference https://app.example.com.

Use a focused prompt after binding your subdomain to align URLs and cross-site navigation cleanly:

Starter prompt · App

Set https://app.example.com as our canonical app origin across metadata, Open Graph tags, sitemap URLs, and email action links. Link the brand link in the footer back to https://example.com and keep authenticated navigation scoped inside app.example.com.

Removing conflicting A, AAAA, and CAA records

Partial outages, mobile-only 404s, and stalled HTTPS certificates almost always trace back to legacy DNS entries left by an older host.

Conflicting A and parking records

Multiple A records on @ cause round-robin routing where half of your visitors reach ExaSpark and half hit an old server or registrar parking page. Delete every non-ExaSpark A record on the connected hostname.

Stray AAAA (IPv6) records

Modern mobile carriers and fiber ISPs prefer IPv6 (AAAA) over IPv4 (A). A leftover AAAA record on @ or www silently sends smartphone visitors to a dead server even while desktop IPv4 loads fine. Remove every stale AAAA row on connected hostnames.

Restrictive CAA (Certificate Authority Authorization) records

A CAA policy on your root domain inherits downward to every subdomain (www., app.). An outdated CAA entry restricting certificate issuers can block automatic SSL until updated or removed.

dns
; BROKEN: parking A, stale IPv6 AAAA, and restrictive CAA
@     300  IN  A      198.51.100.25         ; old registrar parking IP - DELETE
@     300  IN  A      <exaspark-ipv4>
@     300  IN  AAAA   2001:db8::10          ; old host IPv6 - DELETE
@     300  IN  CAA    0 issue "oldca.example" ; blocks new TLS issuance - UPDATE/DELETE

; CLEAN: single target per connected hostname
@     300  IN  A      <exaspark-ipv4>
www   300  IN  CNAME  <exaspark-cname>.

Verifying HTTPS and redirects on every host

Test all four protocol and hostname combinations from your terminal so local browser caches never hide broken redirects:

bash
# Inspect HTTP status and Location headers across all four variants
curl -sI http://example.com | grep -iE "^(http/|location:)"
curl -sI https://example.com | grep -iE "^(http/|location:)"
curl -sI http://www.example.com | grep -iE "^(http/|location:)"
curl -sI https://www.example.com | grep -iE "^(http/|location:)"

# Confirm zero stray AAAA or blocking CAA records
dig @8.8.8.8 example.com AAAA +short
dig @8.8.8.8 www.example.com AAAA +short
dig @8.8.8.8 example.com CAA +short

Your canonical HTTPS URL should return HTTP/2 200 directly, while the other three variants redirect cleanly in one or two hops with valid certificates.

Common subdomain and redirect failures

SymptomRoot causeHow to fix
`https://www.example.com` shows SSL warningwww points to uncertified registrar forwardingRoute www through ExaSpark or an HTTPS-enabled edge redirect
`ERR_TOO_MANY_REDIRECTS` loopOpposing redirect rules or Cloudflare Flexible SSLRemove conflicting external redirect rules and use DNS only (grey cloud)
Logged-in users appear signed out on `www`Both hosts serve 200 OK instead of redirectingRedirect the alternate host permanently (301) to one canonical origin
`/pricing` redirects to bare `/`Basic registrar forwarding drops paths and queriesReplace basic forwarding with a path-preserving 301 redirect
Phones hit SSL error while laptops workLeftover AAAA record routes IPv6 mobile traffic elsewhereDelete stale AAAA records on @ and www
OAuth fails with `redirect_uri_mismatch`Callback URI still lists .exaspark.app or old hostRegister the exact canonical callback URL; see Social login setup

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog