title: Create dynamic subdomains
body: <p>It has been a while since I've been thinking over this feature that some websites are implementing and it looks to be very successful.</p>
  
  <p>Websites like <code>tumblr.com</code>, <code>blogger.com</code>, <code>wordpress.com</code> allow users to register new sub-domain names from within the website by using a simple HTML/PHP form. With my current knowledge of PHP I couldn't figure out myself how this is done. I've read some posts on this and still can't build a clear idea about this.</p>
  
  <p>So, how do I create a script that allows users to register their own sub-domains on my website (<code>www.username.mydomain.com</code>) and more than that, how do I allow them to use a different website template (as <code>wordpress.com</code> does). Is this possible to be done on a shared server or a dedicated server is needed?</p>