i would like to create sub domain for my website dynamically. Is it possible to do so with JSP. For example i would like to create a sub domain for each user registration.
like wise, if www.mywebsite.com is my website, when a user is registered i need to access his profile by www.userName.mywebsite.com. I have posted it already here i think my question was not clear. I am using JSP, and Apache tomcat 5.5
If the question is, “can this be done programtically”, the answer is absolutely yes. If the question is “can this be done with JSP”, the answer is…maybe? I’m not all that familiar with JSP, but to do what you describe you would need to:
www.username.mywebsite.comDNS record;The former is tricky. If you have a server that supports dynamic DNS update, or you’re using a DNS provider with a decent API, then programatically making the update is trivial.
There are a variety of ways of making your webserver aware of the new virtual host. Apache’s mod_vhost_alias module makes this relatively simple; you can read more in the document Dynamically configured mass virtual hosting.
You can also do clever things with
mod_rewriteand database lookups.