I am currently building a new sub-system for a client that will run on a sub-directory like https://example.com/new-subsystem.
Their existing website was native/hard-coded PHP so I have to create a new folder on the root and put the CodeIgniter 3 Framework there. I configured the base_url and voila! It is working fine.
Now the problem is when I try to create a new method inside the controller, it returns error 404 that it seems like that the server is trying to handle the request literally and not let CodeIgniter handle it.
Example
When I try to access https://example.com/new-subsystem, it is working fine.
But when I try to access https://example.com/new-subsystem/test it will show Error 404 and seems like the server is trying to find another folder instead. Here is the actual route.php, config.php, controller which I believe that the problem is not on these three.
routes.php
$route['default_controller'] = 'lockdown';
$route['test'] = 'lockdown/test';
config.php
$config['base_url'] = 'http://localhost/project-lockdown/tutorials/';
Lockdown.php (Controller)
class Lockdown extends CI_Controller {
public function index()
{
// This is working by default. It shows on http://localhost/project-lockdown/tutorials/
echo "Hello World!"
}
public function test(){
// This should show on http://localhost/project-lockdown/tutorials/test
echo "Hello, this is a test method and it is not working. Error 404 is shown!";
}
}
Main Question: How to tell the server that I want CodeIgniter to handle the rest of the request that is thrown under http://localhost/project-lockdown/tutorials/(controller)/(method) and not take it literally.
For now, I am stuck here and still trying to find a solution to it across the internet and can find a thing. I am no .htaccess guy so I think this has something to with the .htaccess magic or something (which I am trying to learn now).
Any help would be appreciated. This problem will not occur if I just throw in CodeIgniter on the root folder.
Thank you in advance.