This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Url rewriting

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am trying to create a blogging application where when users registers different blog is created, so main application is say xyz.com and user T registers then he can browse by typing

T.xyz.com

How can this achieved? Any help would be appreciated
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will require a DNS level API that is capable of adding sub domains. You cannot achieve this redirecting the URL since the DNS name for T.xyz.com will not resolve unless you add the appropriate records in DNS. You will need a CNAME if the subdomain points to the same IP and a 'A record' if the IP address is different for each sub domain.
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks friend but are you sure it's not possible with simple url rewriting?

Refer this link, It says it's possible in Asp.Net so it has to be possible even in Java

http://forums.asp.net/p/942045/1128533.aspx

Waiting for replies.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The discussion thread that you pointed to did not have an answer to the OPs original question. All the people that replied to the thread failed to take into account the fact that a subdomain such as subdomain.domain.com needs a DNS mapping (CNAME or A) in order to redirect the request to the appropriate apache / IIS server in the first place. Without this mapping your web server will not even receive the request.
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But i am trying to make project for my college and i am not working in production environment means my site is not hosted, so how to use DNS level api's and how to test it?
You mean to say, only alternative left is to skip this part? let the url show as it is? rather than falling into this complex DNS level api's?
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you do not want a separate sub domain record you can use a wildcard that will catch all sub domains. Some info on that here -> http://ma.tt/2003/10/wildcard-dns-and-sub-domains/

As for the DNS thing, you can install your own DNS server and add records to it and do reloads to achieve the functionality.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure if servlets is the best place to ask this. But decide on what solution you want and we can then move the post if required.
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now you got my point friend! That i what i was asking. I don't want to create any subdomains. Wildcard char * should be sufficient. Now let me refer the link to which you pointed. And this is only conceptual help i required. I didn't know where to post this on this forum. So i posted it in this. You may now move it to any place you want. I will ask more doubts if needed after reading the link. Thanks
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what do you mean by add DNS server? aren't DNS server global? which has mapping for each and every(most of) site's ip address? How can i add my DNS server privately on localhost? and can you name any DNS server that i can install on my machine?
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, but the link to which you pointed, i am not getting anything out it. If i use wildchar *, the request will be caught but how can i then use that request and make it meaninful in my code so as to fetch correct information from database?

If i use url mapping like

nitesh.xyz.com

it should map to
xyz.com?uid=nitesh


I still didn't get how to do that after reading that link
 
Nitesh Panchal
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepak, No replies from you ??
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic