Skip to content

Redirect with and without www

Does the website redirect cleanly to the main address in the other spelling, with or without www?

What we check

We open the website in the other spelling: with www if it runs without, and without www if it runs with. Then we follow all redirects and see where we land:

  • On the main address: everything is fine.
  • Error or not reachable: warning. Usually the DNS record is missing or the certificate does not cover this spelling.
  • The page is served without a redirect: warning, or only a note if a canonical tag tells Google the valid address.
  • On an entirely different website: note, because this can be intended.

Why it matters

People type addresses sometimes with and sometimes without www. On business cards, posters, brochures and in old directory entries the other spelling often appears. If it is not reachable, these visitors land on an error message and may look elsewhere instead.

If both spellings serve the page, Google sees two websites with the same content. Links from other websites are then split between the two, and neither is rated as strongly as it could be.

How to fix it

Three things are needed:

  1. DNS record for both spellings. At the domain provider there must be a record pointing to the hosting for both example.ch and www.example.ch.
  2. Certificate for both spellings. The SSL certificate must cover both names, otherwise the browser shows a security warning before the redirect takes effect. With Let's Encrypt it is usually enough to enter both names in the hosting panel.
  3. Permanent redirect (301). One spelling redirects to the other, to the same subpage.

Hosting panel

With most hosting providers you find an option such as "www redirect" or "Set main domain" in the domain administration.

Apache (.htaccess)

For a redirect from without to with www:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.ch$ [NC]
RewriteRule ^(.*)$ https://www.example.ch/$1 [R=301,L]

Wix, Jimdo, Squarespace

The builders set up the redirect automatically when the domain is connected correctly. If the redirect is missing, check in the domain settings whether both spellings are connected.

How to check it yourself

Type both spellings into the address bar, each with https://. Both should land on the same address, and the main address should be shown in the address bar afterwards.

Frequently asked questions

Which is better, with or without www?

For Google it makes no difference. What matters is that one spelling applies and the other permanently redirects to it.

What is the difference between 301 and 302?

301 means "moved permanently". Google then transfers all signals to the new address. 302 means "temporary" and is wrong for this purpose.

My website runs on a subdomain such as shop.example.ch. Does this apply to me?

No. The check only applies to main domains. A subdomain has no www variant that would have to redirect.

Check a website now

We check "Redirect with and without www" and all other points in a few minutes, free and without sign-up.