webzod
account

Redirect www and apex to one host on Netlify

headers.redirect.www_split · effort: minutes

Why it matters

Both names serve the site, so search engines see duplicate pages and logins, cookies and HSTS are split between two hosts. Pick one canonical host and permanently redirect the other to it.

The fix

  1. Set the canonical name as the primary domain; Netlify redirects its www/apex counterpart automatically. Remove the other name if it is listed as a separate alias.
  2. If both still serve the site, add the rule below to _redirects in the publish directory and redeploy.
_redirects
https://www.example.com/* https://example.com/:splat 301!

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.