title: Building a SaaS application in CodeIgniter like Shopify with custom domain alias
body: <p>I am working on a SaaS application. We take <strong>Shopify / Magento</strong> Go etc as reference.</p>
  
  <ul>
  <li>I used CodeIgniter PHP framework.</li>
  <li>SaaS Methodology - Multiple database, single code-base</li>
  </ul>
  
  <p>Our SaaS architecture is as follows:</p>
  
  <p><img src="https://i.stack.imgur.com/83ooj.png" alt="SaaS Architecture"></p>
  
  <ul>
  <li>when a customer signup a database is build with his name and contain his specific databases.</li>
  <li>when a customer signup he get a sub-domain (Ex: test1.example.com)</li>
  <li>The customer can add his own domain that points to the system defined sub-domain. (Ex: test1.example.com to www.mydomain.com )</li>
  </ul>
  
  <p>How to achieve this functionality?</p>