Remove "Welcome View" (CI 4) |
Hey,
I just started using CodeIgniter and my initial goal is to remove the default "index" (welcome_message) Firstly, I deleted the Controller "Home.php" and created a "Pages.php" Controller with the following content: PHP Code: <?php Then I removed the default Route and replaced it with my own: PHP Code: /** As you see I'm using a quite "dirty" way to check if the user is on the index site, I cant use the "index()" function, because it always returns a 404. What am I doing wrong?
You still need to have a Default Controller. This will also change the default index() into renderPage(). So that you don't need multiple functions.
Your code makes you vulnerable to directory traversal attack. You should read up on that! PHP Code: $routes->setDefaultController('Pages');
(02-01-2020, 07:27 AM)jreklund Wrote: You still need to have a Default Controller. This will also change the default index() into renderPage(). So that you don't need multiple functions. Thank you, that did the trick! |
Welcome Guest, Not a member yet? Register Sign In |