2

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..

4
  • 2
    Are 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... Commented 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 ? Commented 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. Commented 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 ? Commented Apr 20, 2010 at 7:23

2 Answers 2

3
  1. you need a DNS server that will resolve any subdomain as the adress of your server,
  2. 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.

Sign up to request clarification or add additional context in comments.

10 Comments

i don't think that blogspot creates subdomain for each regustration.. what say ? there should be some another tweak...
well, if you are using BIND, you can use a wildcard * in an A record
btw what are these values... 1237374933 10800 3600 604800 38400 ? will it remain same for my case?
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.
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"; };
|
1
  1. Buy a domain name at you're favorite ISP.

  2. 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.191 
  3. Code 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

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 ..
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.
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 ?
The easies way is to use the DNS server of you’re ISP and configure the A record via their web interface.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.