“www” on subdomains
Many websites offer subdomains, but most of them fail when they are accessed with a “www”, such as http://www.subdomain.domain.com. The reality is that many users always write the three ‘w’s every time they write a web address. For this reason, I will explain how easy it is to configure your website to work with the “www” before a subdomain.
The trick is in the CNAME configuration. Just as you assigned a CNAME to your subdomain.domain.com, you now assign the “www.subdomain.domain.com” as a CNAME to “subdomain.domain.com”
An example entry of your Custom DNS Setting should look like this:
CNAME Record subdomain IN CNAME somesite.site.com
That will map your http://subdomain.domain.com to the site.com location. When users type in the “www” they will be sent to a “Page not Found” error page. To fix this, you add the other CNAME Record so that now it looks like this:
CNAME Record subdomain IN CNAME somesite.site.com
CNAME Record http://www.subdomain IN CNAME subdomain.domain.com
This last entry will fix your “www” problem for that subdomain.
Will this work if you have mutiple subdomains?
Thank you!
Yes, this works for multiple subdomains. Just repeat these steps for all subdomains.
Hi Rafael,
Although your post is already more than one year old, it helped me. Thanks for the post
Super helpful! Thanks!
great advice! thanks!
nobody types www anymore, not necessary. Browsers automatically take you to the site when you type domain.com. I was thinking also what if the main domain is setup in google to prefer www. but the subdomain doesn’t have the www will this effect seo for subdomain ?
Hi nomad,
If the domain is not properly configured, a user could be taken to an error page when they type the “www” or when they don’t type it.
In terms of SEO, as long as your configuration is taking you to one form of the domain, then there would be zero chance of having a negative impact in your SEO, since there would not be any duplicate content issues.
Isn’t this better handled at the web server level? i.e. with Virtual Hosts?
I think it is best handled at the domain level configuration with your registrar. However, if that is not an option, then I would configure it at the web server level.