Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Jun 8 '11 at 14:27

This question came from our site for professional and enthusiast programmers.

3 Answers 3

  1. You can go upto wat ever sub level you want to (Up to the Hosting Provider Limit if any)
  2. 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
  3. 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.
share|improve this answer

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.

share|improve this answer
2  
"You.can.go.as.deep.as.you.want" TWSS ^_^ (Yes I'm proud of my maturity) –  sam Jun 8 '11 at 17:53
1  
concerning wildcards, you should have a look at serverfault.com/a/483625/45248 –  Tobias Kienzler Nov 22 '13 at 11:03

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?

Browsers will send the FQDN in the Host header. How the web server handles that depends on the web server.

You can configure a separate docroot for each — and you should, 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.