Help for owners
My website doesn't work without www, but the www address loads fine
Short answer
A website that doesn't work without www, or works only without it, has one of its two names missing a piece: a DNS record, a certificate that covers that name, or a redirect to the main address. Both names need DNS records, the certificate must cover both, and one should redirect to the other. Google recommends picking one URL and redirecting the duplicates to it.
Does this sound like your situation?
- Typing my domain without www gives an error, but with www it loads.
- One of the two addresses shows a security warning about the certificate.
- Google shows my site under both versions of the address.
- Links in my emails that leave out www go nowhere.
- It works on office Wi-Fi and fails for some customers on mobile data.
Why does this happen?
One name has no DNS record
The bare domain and the www name are separate entries in DNS, the address book that tells browsers which server to contact. If only one has a record pointing at your host, the other name cannot reach the website at all, and the browser reports that the site can't be found.
The certificate covers only one name
Google's guidance on duplicate URLs notes that for HTTPS the certificate must match the host name, and warns against serving a certificate made for a different host. A certificate issued for www.example.com alone makes browsers warn visitors who type example.com.
Confirmed by developers.google.comTechnical detail: The certificate OpenSSL made has no Subject Alternative Name
No redirect joins the two addresses
Google advises picking one URL as the canonical, or main, version and redirecting traffic from the others to it, with server-side redirects taking effect fastest. Without a redirect, both names can load separately or one can show the host's default page.
Confirmed by developers.google.com
The server only listens for one name
The web server has to be told about both names. When its configuration lists only www, requests for the bare domain land on a default site or an error page even though DNS is right.
Technical detail: nginx warns that a conflicting server name was ignored
What can I do about it today?
- Test all four versionsOpen http and https, each with and without www, on your phone using mobile data and on office Wi-Fi. Note which ones load, warn or fail.
- Save the exact errorTake a screenshot of each error, especially any certificate warning, since its wording tells a developer which piece is missing.
- Look at the DNS records, read onlyIn your DNS provider, check for a record for the bare domain and one for www. Write down what they point to and change nothing yet.
- Choose your main addressDecide whether customers should see the address with or without www. Either works, as long as the other one redirects to it.
When should I bring someone in?
- Your domain, DNS and hosting sit with three different companies.
- The problem shows as a certificate warning on one version.
- Business email uses the same domain and you are worried about breaking it.
How do I handle it?
- Check each layer from outsideI query DNS for both names, read the certificate each one serves and follow every redirect, so the missing piece is named.
- Add only the records that are missingWebsite records are added or corrected, and the mail records in the same zone are left untouched, with a copy of the zone saved first.
- Issue one certificate for both namesThe certificate is reissued to cover the bare domain and www together, and renewal is checked so the fix lasts.
- Set one permanent redirectThe secondary address gets a server-side 301 redirect to the main one, internal links use the main address, and pages carry a matching canonical tag.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Should my main website address use www?
Either choice works. Pick one, redirect the other to it and use the main version in your own links and marketing.
Will fixing the www problem affect my email?
Website and email records live in the same DNS zone, but they are different records. Change only the website records and keep the mail records exactly as they are.
Does Google treat the www and non-www versions as two sites?
Google treats them as duplicate URLs of the same pages. Its guidance says redirects and rel canonical tags help it pick the version you prefer, and the methods work better combined.
Why do some customers get an error when the site loads for me?
Your browser may remember an old redirect or DNS answer. Testing on mobile data, in a private window, shows what a new visitor sees.
Sources
For your developer: the technical fixes
Related help
- Heroku App Sleeping or Slow on First VisitHeroku's Eco dynos put a web app to sleep after 30 minutes without web traffic and wake it when the next visitor arrives, after a short delay.
- My website address suddenly shows an errorA domain usually stops working because it expired, because someone changed its DNS records, or because the server behind it is down.
- An old address on my domain, like shop. or promo., now shows pages I never madeAn old subdomain shows someone else's site when its DNS record still points at a cloud or hosting service you closed, and another person has claimed that service name.
- My Server Keeps Crashing: Causes and First StepsA server that keeps going down is rarely random.