On this page
A domain can resolve to your website’s server without redirecting visitors to your preferred address. Before launch, check both the apex domain, such as example.com, and the www hostname: each needs working DNS and HTTPS, and any intended redirect must send visitors to the right destination.
Key Takeaways
- DNS resolution helps a browser find a destination; an HTTP redirect tells it to request another URL. DNS records do not redirect browsers.
- Test
https://example.com/andhttps://www.example.com/separately, even if they point to the same service. - The hostname receiving an HTTPS request needs a valid certificate before it can send a redirect over HTTPS.
- Check the final browser address, not just whether the page appears to load.
Custom domain DNS versus HTTP redirect
Suppose you want visitors to use https://www.example.com/. You configure DNS so that both example.com and www.example.com lead to your hosting service. That alone does not make the browser switch from the apex address to the www address.
A redirect requires the receiving web service to respond to a request with an HTTP redirect status and a Location header naming the destination. For example, the service could redirect https://example.com/ to https://www.example.com/. Alternatively, it could serve the same site at both addresses without changing the browser’s address bar.
The apex domain is the bare domain, such as example.com; www.example.com is a separate hostname. Both need to be configured at the destination service if you expect both to work. The direction can be reversed if you prefer the apex address—the important point is to choose one and verify the behavior.
Advertisement
1. Check DNS for both hostnames
In your DNS provider’s dashboard, compare the records for the apex and www against the instructions from your hosting provider. Check that the records point to the intended service and that you have not left an old destination in place. If IPv6 addresses are configured, check those too: some visitors may reach the site over IPv6 rather than IPv4.
If you have dig installed, you can also query DNS from a terminal. Replace the example names with your own domain:
dig +short example.com A
dig +short example.com AAAA
dig +short www.example.com A
dig +short www.example.com AAAA
dig +short www.example.com CNAME
A record lookup helps you see what a DNS resolver returns; it does not prove that the site will serve the correct content or redirect. An empty answer for one record type is not necessarily a problem—for example, a hostname does not need an IPv6 address simply because you queried for one. Recent DNS changes can also take time to appear consistently because of caching.
A CNAME for www is a DNS alias, not an HTTP redirect. Visitors can still see www.example.com in their browser after following that alias.
Provider-specific setup: DNS record names, apex-domain options, domain verification, and certificate provisioning vary by provider. This article could not verify provider documentation, so consult the current instructions from your DNS provider, hosting service, and certificate provider before making changes. Avoid copying an example IP address or record value from an unrelated tutorial.
2. Verify HTTPS on each hostname
Open both addresses directly in a browser:
https://example.com/https://www.example.com/
Neither should produce a certificate warning. A certificate mismatch can occur when the certificate presented for a hostname does not cover that hostname. For example, a certificate valid only for www.example.com does not automatically make example.com valid.
This matters even if the apex domain is supposed to redirect to www: the browser must establish HTTPS with example.com before it can receive that HTTPS redirect. Do not bypass a certificate warning to declare the launch check successful. Add the missing hostname to your hosting or certificate configuration, follow the provider’s verification steps, and wait for the corrected certificate to be available.
Also check plain HTTP if you expect it to work:
http://example.com/http://www.example.com/
They should reach the intended HTTPS address or behave as your launch plan specifies. Browsers may upgrade HTTP automatically or remember past redirects, so a fresh browser session and the command-line checks below can help you distinguish browser behavior from server behavior.
3. Inspect the redirect and final destination
Use your browser first: enter each HTTPS address, let the page finish loading, and inspect the address bar. Confirm that it shows the domain and path you intended, not an old host, a temporary service address, or an unexpected third-party domain. Test a representative page and query string as well as the homepage if those must survive the redirect.
For a closer look, use curl in a terminal. These commands make an ordinary GET request and display the response headers without printing the response body:
curl -sS --max-time 10 -D - -o /dev/null https://example.com/
curl -sS --max-time 10 -D - -o /dev/null https://www.example.com/
If the first response is a redirect, look for its status and Location header. A successful page response without a redirect can be correct for your chosen primary hostname. It can also mean the secondary hostname merely serves the page instead of switching addresses.
To follow redirects and print the final URL, run:
curl -sS -L --max-redirs 10 --max-time 20 -o /dev/null -w 'Final URL: %{url_effective}\n' https://example.com/
curl -sS -L --max-redirs 10 --max-time 20 -o /dev/null -w 'Final URL: %{url_effective}\n' https://www.example.com/
By default, curl checks HTTPS certificates; keep that check enabled. A certificate error, a redirect loop, or a timeout is a reason to investigate rather than a successful check. These examples have not been executed here. Command-line behavior may differ from a browser if the site redirects based on cookies, device, or other request details, so check the browser too.
A redirect checker can help inspect HTTP redirect responses and their destinations. It cannot establish that your DNS configuration is correct or replace a direct HTTPS certificate check. Avoid submitting private URLs or URLs containing credentials or sensitive query parameters to an online checker.
Advertisement
Common Mistakes
- Configuring only one hostname. Adding
wwwat the host does not necessarily configure the apex, or vice versa. Check DNS, host configuration, and certificate coverage for each. - Treating a CNAME as a redirect. It can help resolve a hostname but does not instruct the browser to change URLs.
- Assuming a redirect fixes HTTPS automatically. An HTTPS redirect from a hostname still requires a valid certificate for that starting hostname.
- Checking only the homepage. A redirect may drop a path or query string, or send every request to the homepage. Test representative URLs and decide what behavior you need.
- Trusting a cached result. DNS caching, browser redirect caching, and HTTPS upgrades can obscure a recent change. Compare results from a fresh browser session and a command-line request.
- Ignoring an old destination. Review the final address and redirect chain for retired hosting accounts, temporary domains, or unexpected external destinations.
Best Practices
Choose a primary hostname and configure the other hostname to redirect to it at the web host, proxy, or redirect service—not in DNS alone. Follow your providers’ current instructions for both domain setup and certificate coverage.
Before changing a live domain, record the existing DNS and hosting settings so you can diagnose or reverse a mistake. After changes, repeat the DNS, HTTPS, and destination checks from another network or device if possible. If results differ, allow for caching and check whether both IPv4 and IPv6 destinations are configured correctly.
Conclusion
A successful DNS lookup is only the first launch check. Verify that both hostnames have valid HTTPS, then confirm that each browser-visible destination matches your chosen domain and preserves the URLs your visitors need.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.