Consider the case of blogspot.com the domain is the one blogspot.com only but suppose i register in it with xxx then i will have xxx.blogspot.com like wise here it won't be the subdomain (i can smell) , but its some thing different ... how to achieve this ?? in j2ee web application..
- 2Are you asking how to create sub domains using Java in your site? Something specific to BlogSpot? It's very hard to understand what you're trying to do...Kobi– Kobi2010-04-15 09:16:41 +00:00Commented Apr 15, 2010 at 9:16
- nop i am not asking how to create sub domain.. but how to achieve this URL pattern.. there should be some another tweak... i don't think that blogspot creates subdomain for each regustration.. got it ?Jigar Joshi– Jigar Joshi2010-04-15 09:42:52 +00:00Commented Apr 15, 2010 at 9:42
- This is not programming related. This is serveradmin related. By the way, please put a bit more effort in your English in the question and the comments. You're writing like a little child in a chatroom, it does not encourage us to put effort in to post a professional answer.BalusC– BalusC2010-04-15 12:22:13 +00:00Commented Apr 15, 2010 at 12:22
- One more question i have is suppose i buy a domain over internet, then how i can i achieve this configuration ? i have temporarily locally configured this DNS but what if i want each node in internet to resolve this pattern , how can this reflect all DNS ?Jigar Joshi– Jigar Joshi2010-04-20 07:23:56 +00:00Commented Apr 20, 2010 at 7:23
Add a comment |
2 Answers
- you need a DNS server that will resolve any subdomain as the adress of your server,
- you j2ee application can optain the hostname from the request header
UPDATE: here is a example of a BIND zone file:
$ttl 38400 mauriceperry.ch. IN SOA ks31441.kimsufi.com. maurice.mauriceperry.org. ( 1237374933 10800 3600 604800 38400 ) mauriceperry.ch. IN NS ks31441.kimsufi.com. mauriceperry.ch. IN NS ns.kimsufi.com. * IN A 213.186.61.21 Here xxx.mauriceperry.ch will resolve to 213.186.61.21 whatever xxx is.
10 Comments
Jigar Joshi
i don't think that blogspot creates subdomain for each regustration.. what say ? there should be some another tweak...
Maurice Perry
well, if you are using BIND, you can use a wildcard * in an A record
Jigar Joshi
btw what are these values... 1237374933 10800 3600 604800 38400 ? will it remain same for my case?
Maurice Perry
No, they should be adapted. I don't remember what they all are, but the first is a sort of version number that needs to be updated each time the zone file is updated, so that the other DNS servers know when a refresh is needed.
Jigar Joshi
Refering this link:ulyssesonline.com/2007/11/07/… /etc/bind/named.conf.local # Our domain zone zone "mydomain.com" { type master; file "/etc/bind/zones/mydomain.com.db"; }; # For reverse DNS zone "200.1.192.in-addr.arpa" { type master; file "/etc/bind/zones/rev.200.1.192.in-addr.arpa"; };
|
Buy a domain name at you're favorite ISP.
Configure for this domain a domain wildcard for the A record in the DNS zonefile (usualy using some nice tool from you're ISP):
* IN A 74.125.77.191Code a Java Servlet (or whatever you are using) as front controller. The front controller will dispatch you to what ever the subdomain needs to show.
String domain = request.getLocalName(); String subdomain = domain.substring(0, domain.indexOf('.')); goto(subdomain); // or what ever you need for the subdomain
4 Comments
Jigar Joshi
Thankx... can you help me what to do if i want to set up it in my local machine ? its linux.. i have installed bind9 i don't know the configuration ..
Kdeveloper
Bind is not exactly an easy package to configure correctly. I would rather advice using dnsmasq. But why go through all the trouble if you can buy for $2 a domain name at godaddy.com that includes a free DNS server? If you just want to do a proof of concept, you can just edit the /etc/hosts file and add the needed (sub)domains. Although no wildcards are allowed in the hosts file, you can add as many domains as you like.
Jigar Joshi
One more question i have is suppose i buy a domain over internet, then how i can i achieve this configuration ? i have temporarily locally configured this DNS but what if i want each node in internet to resolve this pattern , how can this reflect all DNS ?
Kdeveloper
The easies way is to use the DNS server of you’re ISP and configure the A record via their web interface.