title: Setting database dynamically according to sub-domain URL in codeigniter?
body: <p>I am working on codeigniter site.I have one single application this application is used by various user each user is having its own DB(Its own clients also).I need the way how to approach this cloud system.
  As i have the single copy of application folder and only the difference in DB for each user.
  I have tried by creating subdomain directory in codeigniter and writing index file and htaccess file so that i can access my original application.but i need the subdomain path in url and way how to connect to the database according to that subdomian url path.</p>
  
  <p>htaccess file.</p>
  
  <pre><code>RewriteEngine On 
  RewriteRule /test/(.*) /$1 [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php
  </code></pre>
  
  <p>which way  i should follow to complete this work.Please help
  Thanks in advance.</p>