I am trying to create url like sub2.sub1.subdomain.domain.com. I am planning to use this to display different content.
my questions are…
1) Is it possible to create such multi level sub domains? – is this based on the hosting company?
2) Isn't sub2.sub1.subdomain a different subdomain rather than a sub domain of sub1?
3) Will all of these subdomains have their own doc roots?
4) How will I handle users coming with and without www.
Any other potential issues that might arise?
EDIT:- How does this affect the behaviour of cookies?
Can I access a cookie set on subdomain.domain.com on sub1.subdomain.domain.com or sub2.sub1.subdomain.domain.com
Best Answer
Yes. You can have as many levels as you like in DNS.
Your host might limit what you are able to do.
That isn't a useful distinction.
Assuming that all the subdomains end up resolving to the same IP address (and they really don't have to):
Browsers will send the FQDN in the
Host
header. How the webserver handles that depends on the webserver.You can configure a separate Document Root for each — and you should (to avoid duplicate content penalties in search engines), unless you are going to do stuff to dynamically determine the content based on the FQDN.
However you like.
www
is only another subdomain without any special properties (other than convention). It is widely considered to be a good idea to pick either "with www" or "without www" as your canonical primary site and redirect the other one to it.