Pick one canonical hostname
Serve your site from a single address and redirect all the others to it.
15 min
why this matters
When example.com and www.example.com both serve content, search engines split your ranking signals across two sites and your analytics counts one visitor as two.
Step by step
- 1
Decide which one wins
Either is fine — pick the version already used in most of your links and advertising, and stick to it everywhere.
- 2
Redirect the other version
Give the non-canonical hostname its own server block that only redirects.
server { listen 443 ssl; server_name www.example.com; return 301 https://example.com$request_uri; } - 3
Add a canonical tag on every page
This is your backstop for parameter and tracking-tagged URLs.
<link rel="canonical" href="https://example.com/pricing" /> - 4
Update the places that hardcode the old host
Sitemap, robots.txt, Search Console property, email templates, ad destination URLs and any hardcoded links in your app.
how to check it worked
- Every variant ends on the same final URL after redirects
- There is exactly one 301 hop, never a chain
related guides
Fix a site that isn't responding
None of the four common addresses for your domain returned a working page. Work through DNS, then the server, then the firewall.
Put your site on HTTPS
Install a free TLS certificate and serve every page over HTTPS.
Redirect HTTP traffic to HTTPS
Send every insecure request to the secure version with a permanent 301 redirect.
Cut your server response time
Get time-to-first-byte under 500ms with caching and a CDN.