WWW and non-WWW
www.example.com and example.com are two different host names that can be set up to show the same website. The letters www are a common subdomain; a site does not need them in its address.
Why do some sites use www?
In www.example.com, www is a label before the domain example.com. It is part of the host name in the URL, just as shop is in shop.example.com. The label became a familiar convention for web addresses, but it is not a special requirement of the web. A site can use example.com, www.example.com, another subdomain, or more than one of these addresses.
Why might one address work while the other does not?
The DNS and website service must be set up for each host name visitors are expected to use. Alex’s portfolio might work at example.com while www.example.com shows an error because nobody configured that second name to reach a service. A record for one name does not automatically create a working setup for the other.
The owner can configure both names to show the site, or make one address send visitors to the other. For example, Alex can choose https://example.com as the address she shares. When someone opens https://www.example.com, her site can respond with an HTTP redirect—a response that tells the browser to open a different address. The browser then displays the site at https://example.com. Both host names need to reach a service capable of providing the site or issuing the redirect.
DNS records and web redirects do different jobs. DNS helps a browser find the service for a host name. An HTTP redirect is a response from a web service that changes the address the browser opens. Pointing www.example.com to the same server as example.com does not, by itself, change the address shown in the browser.
What should visitors type?
If both addresses are configured, visitors can usually type either one. A redirect can keep the browser on the site’s chosen address. For example, if Alex shares https://example.com/about, a visitor who starts at https://www.example.com/about may be sent to https://example.com/about instead. The redirect should preserve the requested page so the visitor does not end up at the homepage every time.
For HTTPS, the site must also be able to serve a valid certificate for the host name a visitor opens, or complete the redirect over a secure connection. A certificate for one name does not necessarily cover the other; the provider’s certificate setup must include the names that visitors use.
Related terms
- Subdomain — explains why
wwwis a name below the domain - Redirect — explains how a browser can be sent from one address to another
- DNS record — information that helps direct requests for each host name