Skip to content

You type your address into the browser, add www in front, and the site loads without trouble. Then a customer writes in to say that the same address without www shows an error, a blank page or a message that the server cannot be found. Nothing seems to be broken, and yet half of your visitors may be seeing a dead site. This is one of the most common domain problems, and it almost always has a simple cause.

This article explains why the bare domain (also called the apex or root domain) and the www name behave as separate addresses, how to confirm which one is failing, and how to repair it. The steps use ordinary DNS tools and a normal DNS control panel, so you can follow them whether your site is a small shop, a company page or a blog. If you want a reference of every record type mentioned here, keep the DNS record cheat sheet open in another tab.

Why example.com and www.example.com are two different names

In the Domain Name System, every name is its own entry. The name example.com and the name www.example.com are not the same thing, even though people treat them as one. The first is the domain itself. The second is a subdomain called www that sits under it. The original DNS design, described in RFC 1034 and RFC 1035, allows each name to have its own records, and a lookup for one name never looks at the records of another.

That is why you can have a perfectly working site on one form and a failure on the other. When you set up hosting, the instructions often say "point your domain to this IP address". Many people create one record, for either the bare domain or www, and assume that covers both. It does not. A browser that asks for the missing name receives no answer, or an answer that leads nowhere, and shows an error.

There is a second layer as well. Even when both names resolve to the same server, the web server software must be configured to answer for both of them. A server that knows only about www.example.com may refuse, redirect incorrectly or serve a default page when it receives a request for example.com. So a "works with www only" problem can live in DNS, in the web server, in the SSL certificate, or in more than one of those places at once.

The usual causes at a glance

Before touching anything, it helps to see the common patterns side by side. The table below lists what you observe and what is usually behind it.

What you see Most likely cause Where to fix it
www works, bare domain says "server not found" No A or AAAA record for the bare domain DNS control panel
Bare domain works, www says "server not found" No record for the www subdomain DNS control panel
Both resolve, bare domain shows a default server page Web server has no virtual host for the bare domain Hosting or web server settings
Bare domain shows a certificate warning SSL certificate covers www only Certificate settings
Bare domain redirects forever Redirect rules point both names at each other Redirect rules or website settings
Bare domain works on one network only Old DNS answer cached somewhere Wait for TTL, then recheck

Most real cases fall into the first or the third row. A missing record is the easiest to find, so start there.

Step 1: Confirm which name fails and how

Do not guess. Check each name separately and write down the result.

  1. Open a private browser window so that saved redirects and cached pages do not mislead you.
  2. Visit the bare domain with https and then with http. Note the exact message. "This site can't be reached" or "server not found" points to DNS. A certificate warning points to SSL. A default web server page points to the web server configuration.
  3. Repeat for the www name.
  4. Run a DNS lookup for both names. On macOS or Linux you can use a command such as dig example.com and dig www.example.com. On Windows, nslookup example.com and nslookup www.example.com work in Command Prompt. Online DNS lookup pages give the same information if you prefer a browser.

Read the answer carefully. If the lookup for the bare domain returns an IP address, DNS is probably fine for that name and your problem is further along the chain. If it returns nothing, "NXDOMAIN" or "no records found", the record is missing or has not been published yet. If www returns a CNAME that points to another host name, follow that chain until you see an IP address at the end.

Step 2: Look at what is in your DNS zone

Open the DNS management page for your domain, the screen where you add A, AAAA, CNAME, MX and TXT records. Find two lines: the one whose name is the bare domain (often shown as @ or left blank) and the one whose name is www.

A healthy, simple setup looks like this:

Name Type Value Purpose
@ A the IPv4 address of your server Bare domain
www CNAME example.com www points to the bare domain

Another equally valid setup gives www its own A record with the same IP address. What matters is that both names lead to the same destination. If you also use IPv6, add an AAAA record for the bare domain as well, and make sure it points to a server that really answers on IPv6. A wrong AAAA record is a quiet way to break a site for some visitors only, because browsers that prefer IPv6 will try it first.

If you only see a record for www, add the missing one for the bare domain. If you only see a record for the bare domain, add the www entry. Save the change and note the time, because you will need it when you judge whether a cache is still holding the old answer.

Step 3: Understand the CNAME rule at the root

Many people try to fix the problem by adding a CNAME record to the bare domain, so that it points to a host name given by their hosting company. The DNS standard does not allow this. A CNAME means "this name is an alias of that other name, so use every record of the other name". It cannot sit next to any other record on the same name. The bare domain always carries at least SOA and NS records, and often MX and TXT records for email, so a CNAME there conflicts with them.

Some DNS providers offer a special alias-style record (sometimes called ALIAS, ANAME or CNAME flattening) that behaves like a CNAME at the root by returning the final IP addresses. This is a provider feature and not part of the basic standard, so check your own panel before relying on it. If your panel offers only the basic record types, use an A record on the bare domain with the IP address your host gives you, and a CNAME or another A record for www.

Be careful that a CNAME on www is also exclusive. If you have created a CNAME for www and then add a TXT or A record for the same name, the panel should warn you. Remove the conflicting entry rather than keeping both.

Step 4: Check the web server and the SSL certificate

Once both names resolve to the same IP address, test again in the browser. If the bare domain now loads the wrong site, a default page or a certificate warning, DNS is no longer the problem.

On shared hosting or a control panel, look for the setting where the domain is attached to the website. Many panels let you add the www version as an alias of the main domain, or the other way around. If you manage your own server, the virtual host or server block must list both example.com and www.example.com as accepted names.

For HTTPS, check that the certificate covers both names. A certificate issued for www.example.com alone will trigger a browser warning when a visitor opens example.com. The fix is to reissue the certificate with both names, or to use one that covers the bare domain and its subdomains. Automatic certificate tools usually let you list several names in one request. If you are not sure how your certificate was issued, open the certificate details in the browser and read the list of names it includes.

Step 5: Choose one preferred address and redirect the other

Even when both names work, it is better not to serve the same site at two addresses. Search engines may treat them as separate pages, analytics get split, and shared links end up in two forms. Choose one version as your main address. Either one is acceptable; the important thing is to be consistent.

Then make the other name redirect to it with a permanent redirect (HTTP status 301 or 308). Most website platforms and hosting panels have a setting called something like "force www" or "redirect to non-www". Use it rather than writing your own rules if you can, because it handles HTTPS and paths correctly.

After setting the redirect, test these four addresses and confirm that all of them land on the same final page over https:

If any of them loops, shows a different page or drops the path, review your rules. A common mistake is to set a redirect in the website settings and a second, opposite redirect in the hosting panel, so that each sends the visitor to the other.

A plain example

Suppose a small bakery registers bakery-example.com and builds a website. The hosting company says to create an A record for www pointing to 203.0.113.10. The owner does exactly that. The site opens at www.bakery-example.com, so the owner prints the address on flyers without www. Customers who type bakery-example.com see "server not found".

The fix takes three steps. First, the owner adds an A record for the bare domain, using @ as the name and the same IP address as the value. Second, the owner asks the hosting panel to add the bare domain as an alias of the site, which also lets the certificate be reissued for both names. Third, the owner turns on a permanent redirect from the bare domain to www, so everyone ends up on one address. After the DNS change spreads, both forms open the same page, and the flyers work.

Limits and what to watch for

Some things can still trip you up after the records are correct.

  • Caching and TTL. Every record has a time to live. Browsers, operating systems, routers and your internet provider's resolver may keep the old "no such name" answer until it expires. A missing-record answer can be cached too, so a fix may appear on one device before another. If a phone on mobile data fails while a computer works, see why DNS errors appear on mobile but not on PC for the cache and resolver causes.
  • Name servers. Records only count if they are in the zone served by your domain's active name servers. If you edited a zone at a provider that is not the one named at the registry, nothing changes. If you recently moved name servers, read why DNS values do not update after a name server change before editing more records.
  • Email records. The bare domain often carries MX and TXT records for email. Do not delete them while cleaning up. Changing the web records should never require touching mail records.
  • Wildcard records. A record named with an asterisk answers for every undefined subdomain, which can hide a missing www entry during testing or send visitors somewhere unexpected. Check whether one exists.
  • Mixed content and hard-coded links. If your site stores full addresses in its settings, make sure the main address matches the preferred version, or the site may redirect in circles.

A short checklist you can reuse

Keep these questions in order and you will find most www problems in a few minutes.

  1. Does a lookup of the bare domain return an IP address?
  2. Does a lookup of the www name return an IP address, directly or through a CNAME?
  3. Do both lead to the same server?
  4. Does the web server accept both names?
  5. Does the SSL certificate list both names?
  6. Does one name redirect permanently to the other?
  7. Have you waited out the TTL and tested from another network?

If the answer to any question is no, you have found the part to fix.

Summary

A domain that works with www but fails without it is rarely broken in a deep way. The bare domain and the www name are separate DNS names, and each needs its own record, its own web server entry and a certificate that covers it. Check both names with a DNS lookup, add the missing A or CNAME record, remember that a standard CNAME cannot sit at the root, make sure the web server and certificate accept both names, and pick one preferred address with a permanent redirect from the other. If you manage your own domain and want a single place to handle registration and DNS together, you can look at what the domains page offers.

Frequently asked questions

Why does my site open with www but not without it?

The bare domain and the www name are two different DNS names. Each needs its own record that points to your server. If only the www record exists, or only the bare domain has one, visitors using the other form get an error.

Do I need both an A record and a CNAME record?

Usually yes, in some form. A common setup is an A record for the bare domain and a CNAME for www that points to the bare domain. Both names must resolve somewhere, and the web server must also be set up to answer for both names.

Can I put a CNAME on the bare domain?

The DNS standard does not allow a CNAME to share a name with other records, and the bare domain always carries SOA and NS records. Use an A or AAAA record there, or an alias-style record if your DNS provider offers one.

How long until the fix works?

It depends on the TTL of the old record and on caches along the way. Many changes appear within minutes, but some resolvers keep the old answer until the TTL runs out, which can take hours.

Should visitors see www or the bare domain?

Either is fine. Pick one as your preferred address, make the other redirect to it with a permanent redirect, and use the same one in links, sitemaps and certificates.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Ready to register your domain?

Search a name, compare extensions and pay once for the years you choose.

.com registration from $18.81 for the first year

Search domains

Keep reading

Domain & DNS Guides

Nameserver Changed but DNS Not Updating: Why It Happens

After a nameserver change, your DNS edits may seem to do nothing. Learn which provider controls the zone, how caches behave and how to confirm what the world sees.

10 min read

Domain & DNS Guides

DNS Error on Mobile but the Site Works on a Computer: Why?

When one device resolves a domain and another does not, the domain is rarely at fault. This guide explains the usual differences between phone and computer and how to test each.

10 min read

Domain & DNS Guides

DNS Records Cheat Sheet for Website Owners

A, AAAA, CNAME, MX, TXT, NS and SOA explained in plain language, with a quick reference table, TTL basics, a worked example and the mistakes owners make most.

10 min read