CodeIgniter help - using multiple databases in one application and URI routing issue

I am working on a small web application. In my application, I am following the following approach.

Small system preview

  • The app will be hosted on a server like (www.example.com)
  • Clients like Microsoft, Cocacola, IBM .... etc will be subscribed. And clients will access the app using the url (www.example.com/ibm)
  • Each client will have a separate database to store their data.
  • If customer employees want to log in, then the URL pattern should look like this: (Www.example.com/ibm/user/login) ibm - client user - this is the controller login - this is the custom controller method.

How do you achieve this?

Thank you in advance

+3


source to share


1 answer


Thanks to Sundar for your advice. We can only achieve this with a little hack in the codeigniter core.



  • Open the text editor system / core / router.php.
  • Go to line number 264 .... function _validate_request ($ segments)
  • Replace $ segments [0] with $ segments [1] OR
  • Add this code on line 270

    $ x = $ segments; $ A = 1; for ($ i = 0; $ i <(count ($ segment) -1); $ i ++) {$ segments [$ i] = $ x [$ a]; $ A ++; }

0


source







All Articles