What host variants are

Your website can usually be reached under four spellings: with and without www, over http and https. If they do not all redirect to one address, search engines see several copies of the same page.

How it works

A domain can be called up in several ways:

  • http://example.com/
  • http://www.example.com/
  • https://example.com/
  • https://www.example.com/

To visitors they look the same. To a search engine they are four different addresses. If several of them serve the page directly instead of redirecting, it finds the same content more than once. It then has to decide for itself which version to show, and links from other websites are split between the copies.

The answer is a single main address. All other spellings redirect to it permanently. bytereport calls up the three other spellings and checks that each one ends up on exactly the address the start page has.

What matters

  • Pick one address. With or without www makes no difference. What matters is that you decide and use the same one everywhere: in links, in the canonical tag and in the sitemap.
  • Always HTTPS. The main address starts with https://. More in What HTTPS does.
  • Status 301. A permanent redirect (301 or 308) tells search engines that the new address is the one that counts. A temporary one (302 or 307) leaves that open.
  • One step where possible. http://example.com/ should point straight to https://www.example.com/, not via two or three stops.
  • Both names need a certificate. If the certificate does not cover the www variant, the connection fails before the redirect can take effect.

How to set it up

The redirects belong in the configuration of the web server or your hosting. Many hosts offer a setting such as “preferred domain” or “force HTTPS”. A redirect from http and from the variant without www to https://www.example.com looks like this:

Web server
server {
    listen 80;
    listen 443 ssl;
    server_name example.com;
    return 301 https://www.example.com$request_uri;
}
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]

With nginx, the www address over http needs a similar block with listen 80 and server_name www.example.com; the Apache rules, for instance in .htaccess, cover every variant. Then set the main address as the site address in your CMS so that it generates the right links itself. If you have no access to the server, your host or agency will do this.

More on Crawlability

Check your website now

The SEO check shows how search engines see your page.

Check website