When a domain does not work with the “www” prefix, it typically means the DNS settings are not correctly configured to handle requests for www.example.com. Follow these steps to troubleshoot and resolve the issue.
Steps to Fix the “www” Domain Issue #
Step 1: Check DNS Records #
- Log in to Your DNS Management Panel:
- Access the control panel of your domain registrar or hosting provider (e.g., OzSpeed hPanel).
- Verify the CNAME Record for www:
- Ensure the CNAME record for
www
points to your domain without “www” (e.g.,example.com
).objectivecCopy codewww CNAME example.com
- Ensure the CNAME record for
- Alternatively, Use an A Record:
- If you prefer using an A Record for
www
, ensure it points to the same IP address as your root domain:cssCopy codewww A 192.0.2.123
- If you prefer using an A Record for
- Save Changes:
- Update and save the DNS settings, and allow up to 24–48 hours for DNS propagation.
Step 2: Check Hosting Configuration #
- Verify Domain Alias in Hosting Panel:
- Log in to your OzSpeed hPanel.
- Ensure that the www version of the domain (e.g.,
www.example.com
) is configured as an alias for the root domain.
- Update Website Settings:
- In your CMS (e.g., WordPress), verify that both the root domain and the www version are included in the site’s URL settings.
Step 3: Set Up a 301 Redirect (Optional) #
- If you want to redirect all traffic to either the www or non-www version:
- Add the following rule to your
.htaccess
file (if using Apache): Redirect www to non-www:plaintextCopy codeRewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Redirect non-www to www:plaintextCopy codeRewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
- Add the following rule to your
- For NGINX, update the server block: Redirect www to non-www:plaintextCopy code
server { server_name www.example.com; return 301 $scheme://example.com$request_uri; }
Redirect non-www to www:plaintextCopy codeserver { server_name example.com; return 301 $scheme://www.example.com$request_uri; }
Step 4: Test Your Domain #
- Open a browser and test both versions:
- www.example.com
- example.com
- Use a DNS propagation checker (e.g., dnschecker.org) to confirm that the CNAME or A Record for
www
has propagated.
Common Causes and Solutions #
- Missing CNAME Record for www:
- Add a CNAME record pointing
www
to your root domain.
- Add a CNAME record pointing
- Conflicting A or CNAME Records:
- Ensure there are no duplicate or conflicting records for
www
.
- Ensure there are no duplicate or conflicting records for
- Hosting Misconfiguration:
- Ensure your hosting account supports both the root domain and the www version as aliases.
- SSL Certificate Issues:
- If using SSL, ensure the certificate covers both
example.com
andwww.example.com
.
- If using SSL, ensure the certificate covers both
Additional Tips: #
- Consistent URL Structure:
- Choose either www or non-www as your preferred domain and set up redirects accordingly for SEO and usability.
- Monitor DNS Propagation:
- Allow up to 48 hours for DNS changes to propagate globally.
- Contact Support:
- If the issue persists, reach out to your hosting or domain provider for additional troubleshooting.