Multiple instances of CI4 and removal of public/index.php/ from url - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Multiple instances of CI4 and removal of public/index.php/ from url (/showthread.php?tid=75795) |
Multiple instances of CI4 and removal of public/index.php/ from url - owino - 03-17-2020 I am working on a project that will solve multiple problems but a user may potentially use more than one of these solutions. So I have an instance of CI4 handling users (logins, passwords etc) with its own database. I have another instance of CI4 implementing a solution to the first problem with its own database. I will soon be using another instance CI4 to solve another problem that I have already identified. But no user should use any of these solutions without going through the CI4 instance that authenticates users among other things basic . . . When I was using CI3, there was no problem. The trouble is that CI4 has introduced the 'public' directory which is now my headache. Whenever an instance X of CI4 is the one active I now have my URL as http://localhost/InstanceXofCI4/public/view. The 'index.php' is out of the way but I am stuck with 'public' directory. Is it possible to hide the 'public' directory without changing the default directory structure? RE: Multiple instances of CI4 and removal of public/index.php/ from url - silviodelgado - 03-17-2020 Your document root mapped path should point to the /public folder, not for root CI4 project folder. E.g.: DocumentRoot /home/user/www/ci4folder/public (03-17-2020, 05:21 PM)owino Wrote: I am working on a project that will solve multiple problems but a user may potentially use more than one of these solutions. RE: Multiple instances of CI4 and removal of public/index.php/ from url - mjamilasfihani - 03-18-2020 You can change the root directory from your server. Example : before www/dirname/ change to www/dirname/public/ Or you can place your CI asset in another directory and put the content of public in your root then change the config of index.php Example : www/user/public_html/index.php <- this is public dir Then I point the codeigniter to www/user/_codeigniter/ (03-17-2020, 05:21 PM)owino Wrote: I am working on a project that will solve multiple problems but a user may potentially use more than one of these solutions. If you use shared hosting, or cant point the root directory. You can choose my 2nd option. If you have root access you just need to change the root directory RE: Multiple instances of CI4 and removal of public/index.php/ from url - Bennito254 - 03-19-2020 Yes, you can remove the public/ directory completely, but this will introduce security issues since all of the CodeIgniter files will be accessible from the web. You can read on how you can set up multiple applications using a single instance of CI4, so that your directory structure could be like system... vendor... writable... public_html app1 app2 Otherwise, if you want all files in your in the same directory as the index, you can create an index.php file in the root of your CI instance then paste the following code PHP Code: <?php RE: Multiple instances of CI4 and removal of public/index.php/ from url - owino - 03-20-2020 (03-18-2020, 03:54 AM)mjamilasfihani Wrote: You can change the root directory from your server. Sorry, I should have stated how my folder structure looks. My document root according to the apache2 server is /var/www/html. In this root directory is where I have copies of instances of CI4. So far I have two copies, the one that authenticates users and one that offers a solution to the first problem. Within the root also is an index.php file whose job is simply to direct visitors to the authenticating instance.Once a user has been authenticated, they are directed to an instance that offers a solution.So the sturcture looks like this /var/www/html/ index.php CI4auth/ CI4soln1/ CI4soln2/ So as I stated, whenever an instance of CI4 is active I now have my URLs as http://localhost/CI4auth/public/view http://localhost/CI4soln1/public/view http://localhost/CI4soln2/public/view etc. My wish is to hide the public directory so that I have http://localhost/CI4auth/view http://localhost/CI4soln1/view http://localhost/CI4soln2/view RE: Multiple instances of CI4 and removal of public/index.php/ from url - mjamilasfihani - 03-21-2020 You can do that with uri routing. It will reduce your time for rewriting again and again, point your root directory first then you can do some experiment with that Happy code |