Routes for large CI3 to CI4 upgrade |
Hello,
The nonprofit organization I work for uses Codeigniter for a very large codebase (around 100 controllers and 750 views). We are planning to upgrade from CI3 to CI4 this year. Since our codebase is so large, we are looking at some sort of routing system that would allow us to have some pages in CI3 and some in CI4 as things are upgraded. So maybe we would have specific routes for pages that have been upgraded to CI4, but then a rule that routes everything else to CI3. I'm wondering if anyone else has dealt with this type of migration before, and could share examples of how you dealt with this? Thank you!
This isn't what I was asking. We actually have CI3 and CI4 running together with CI4 in a subdirectory.
What I'm looking to do is have it so when I convert a page to CI4, we route to the CI4 subdirectory. Otherwise, we route to CI3. So links in the CI4 page would still go to CI3 unless there is a page in the CI4 subdirectory. Since we have so many pages and the conversion is estimated to take a year we are hoping to roll out as we go and not wait to convert everything to roll it out. Any ideas on how to route like that? Thank you!
Thank you!
My colleague came up with a solution that helps with routing pages between CI3 and CI4 while we migrate pages. It doesn't solve the session issue either, but we don't have a need for that at this time. For the solution she implemented, we have CI4 running in a subdirectory within CI3. CI3 has a controller called CI4redirector, and CI4 has a controller called CI3redirector. When we finish converting a page to CI4, we can add a route to the CI3 application/config/routes.php. For example, if we finish the news page our route would look like $route['news']='CI4redirector/ci4/news'; That would redirect the user to CI4. However, we want links on that CI4 page to direct to CI3 or CI4, depending on if we have converted that page or not. To achieve this, we use the CI3redirector within CI4 which routes back to CI3. Here is the code in the CI4redirector controller (located in \application\controllers\CI4redirector.php) Code: class CI4redirector extends CI_Controller { Here is the code in the CI3redirector controller (located in \CI4\app\Controllers\CI3redirector.php) Code: namespace App\Controllers; |
Welcome Guest, Not a member yet? Register Sign In |