Why your site works with www but not without
To a browser, www.yourdomain.com and yourdomain.com are two different addresses unless something explicitly ties them together.
Typing www.yourdomain.com works perfectly. Drop the www and the browser can't reach it, or reaches something entirely different. To you these feel like the same website with two names. To DNS, and to a browser, they are two completely separate addresses that happen to look similar — and nothing connects them unless something has been explicitly configured to.
Why this isn't automatic
www.yourdomain.com is technically a subdomain, no different in kind from shop.yourdomain.com or blog.yourdomain.com. yourdomain.com on its own — the apex or root domain — is a separate record. Each needs its own DNS entry pointing somewhere, and if only one of them has been set up, only that one will work. There is no rule anywhere that makes them behave as a pair by default.
What to check, in order
1. DNS records for both versions
In your DNS zone, you need a record for each:
- The root domain (
yourdomain.com) typically needs an A record pointing at your server's IP address, sinceCNAMErecords aren't permitted at the root of a domain by the DNS standard. - The www version can use either its own A record with the same IP, or a CNAME pointing at the root domain or at your hosting provider's address.
If one of these is missing entirely, that version of the domain has nothing telling browsers where to go, and will fail to resolve at all rather than simply loading the wrong content. Check your DNS zone in your control panel and confirm both records exist and point at the correct destination.
2. Which version your CMS thinks is correct
Even with DNS correct on both, your CMS itself may only be configured to answer for one. WordPress, for example, has a Site Address and Home URL, each set to one specific version. A request for the other version might load, but with broken links, missing styling, or a redirect to the version WordPress actually expects — which can look like "not working" even though DNS is fine.
3. SSL certificate coverage
A certificate has to explicitly list every version of the domain it covers. If your certificate covers www.yourdomain.com but not the root domain — or the other way round — visitors to the uncovered version see a security warning rather than your site, which many people understandably read as "the site is down" rather than "this looks fine, just a certificate issue". Confirm your certificate covers both from your SSL section in your control panel; most modern certificates do this automatically, but it's worth checking after any certificate reissue.
4. A missing or broken redirect between the two
Best practice, and the fix for all of the above at once, is to pick one version as canonical and redirect the other to it, so visitors and search engines are never split between two copies of the same site. If a redirect was set up previously and has since broken — commonly after a change to .htaccess or a plugin update — you can end up with one version resolving on its own and the other failing rather than being redirected.
Load http://yourdomain.com, https://yourdomain.com, http://www.yourdomain.com and https://www.yourdomain.com one at a time in a private browser window. Noting exactly which of the four fail, and how, tells you whether this is a DNS gap, a certificate gap, or a missing redirect before you touch any settings.
Setting up the redirect correctly
Once both versions resolve and both are covered by SSL, add a single redirect rule sending one to the other. In .htaccess, redirecting non-www to www looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301]
Reversing the direction — www to non-www — simply swaps which domain appears in the condition and which appears in the destination. Only set up the redirect in one direction; a rule in both places at once is exactly what produces a redirect loop, covered in our guide on tracing and fixing a redirect loop.
Putting it together
-
Confirm DNS records exist for both the root domain and www
An A record for the root, and either an A or CNAME record for www.
-
Confirm your SSL certificate covers both versions
Check the certificate details in your control panel's SSL section.
-
Choose one version as canonical
Set your CMS's site address setting to match, and add a single redirect from the other version.
-
Retest all four combinations in a private window
You should see exactly one working version and three redirects landing on it.
If it's still inconsistent
Send support the exact output of dig yourdomain.com and dig www.yourdomain.com, along with which of the four address combinations work and which don't. That comparison usually identifies whether the gap is in DNS, the certificate, or the redirect without further back-and-forth.
Frequently asked questions
Should my site use www or not?
Either is fine — there is no ranking or performance advantage to either choice. What matters is that one is set as the canonical version and the other redirects to it, so visitors and search engines are never split between two separate copies of the same site.
Why does this often show up right after adding SSL?
Because a certificate has to explicitly cover both versions of the domain. A certificate issued for only www.yourdomain.com will show a security warning on the non-www version even if DNS and the redirect are otherwise set up correctly.
Related reading
Where to find the A record setting in your DNS zone, what each field means, and how to confirm the change actually took.
How to add a CNAME recordA CNAME points one name at another instead of at an address, and it comes with one hard rule about what else can share its name.
How to force HTTPS on your websiteA certificate being installed does not redirect anyone by itself. Here is the rule that sends every visitor to the secure version automatically.
How to manage DNS records in your control panelAdding and editing the DNS records for a domain that uses your hosting account's nameservers.