Skip to content

Home / Learn / www, slashes & HTTPS

www vs non-www, trailing slashes and HTTPS

Every page on your site can be requested in eight spellings. Pick one, redirect the other seven to it in a single hop, and use that spelling everywhere.

RequestedShould return
http://example.com/pricing301 → canonical
http://example.com/pricing/301 → canonical
http://www.example.com/pricing301 → canonical
http://www.example.com/pricing/301 → canonical
https://example.com/pricing200
https://example.com/pricing/301 → canonical
https://www.example.com/pricing301 → canonical
https://www.example.com/pricing/301 → canonical

www or non-www?

For Google, neither is better. What matters is choosing one. Practical differences are small:

  • www is a subdomain, so you can point it at a CDN with a CNAME and keep cookies from leaking to other subdomains.
  • Bare domains are shorter and read cleaner, and most DNS providers now support CNAME-like records at the apex.

If your site already ranks, keep what you have. Switching is a site move for no gain.

Trailing slash or not?

Google's own guidance treats /pricing and /pricing/ as different URLs, while the root example.com and example.com/ are the same. Either convention is fine; mixing them creates duplicates. Frameworks decide this for you (trailingSlash in Next.js, Nuxt, Vercel and Netlify settings), so align redirects with the framework.

HTTPS

HTTPS is a lightweight ranking signal and Google prefers HTTPS URLs as canonical when duplicates exist. Serve everything over HTTPS, 301 every HTTP URL to its HTTPS twin, and add an HSTS header once you're confident, so browsers skip the HTTP hop entirely.

The one-hop rule

The common failure is stacking these fixes as separate rules: HTTP→HTTPS, then bare→www, then add slash. A backlink to http://example.com/pricing takes three hops. Write the rule so the destination is computed once, from all three decisions.

Generate one-hop rules

Then make it consistent

  • Canonical tags, internal links and the sitemap use the chosen form.
  • Search Console: add a Domain property so all variants report together.
  • Check a sample with the URL normalizer and the bulk checker.

Questions

Is www or non-www better for SEO?

Neither. Google treats them as separate hostnames and picks one as canonical. Choose one, redirect the other to it, and use it consistently.

Does a trailing slash matter for SEO?

Only through consistency. /page and /page/ are different URLs; if both return 200 they are duplicates. Pick one and redirect the other.

How do I redirect HTTP to HTTPS?

With a server-side 301 from every http:// URL to the same https:// URL. In nginx, a port 80 server block with return 301 https://$host$request_uri; in Apache, a RewriteCond on %{HTTPS} off. The redirect generator writes both, combined with your www and slash choice.