subdomain of a subdomain?
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
Solution 1:
Is it possible to create such multi level sub domains?
Yes. You can have as many levels as you like in DNS.
is this based on the hosting company?
Your host might limit what you are able to do.
Isn't sub2.sub1.subdomain a different subdomain rather than a sub domain of sub1?
That isn't a useful distinction.
Will all of these subdomains have their own doc roots?
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.
How will I handle users coming with and without www.
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.
Solution 2:
You.can.go.as.deep.as.you.want.example.com.
1) This is mostly dependent on your DNS - usually, your hosting company manages this; also, if you have a wildcard 3rd-level domain (*.example.com
), then any domain name under example.com
will point to the same host. So, it is possible and works in 90% of the cases.
2) It doesn't matter, really - it all depends on #3
3) If you configure them for different docroots, they will; else they won't.
4) Check the Host:
header - there you'll see what the domain is (with PHP, this data would be in $_SERVER['HTTP_HOST']
), and you can implement some switching logic in your code.
Solution 3:
- You can go upto wat ever sub level you want to (Up to the Hosting Provider Limit if any)
- The best Example is the Folder Level. All are different space. Its like C: > Program Files > Adobe > Acrobat 5.0 > Reader. 3.Yes All the Sub Domain is its own root. Same as Folder Example shown above. But Here you have the privilege to specify the root Folder/Doc
- The User coming With or without "WWW" is handled by your hosting company. If the hosting company supports queries without "WWW" then the request will get to the specific File/Folder.