Codeigniter 4 installed in sub-folder
CI seems to be looking at the sub-folder to use as the controller (using auto route – ie no routes), I even set up a route to try to direct the url to the correct controller but it still looks at the wrong url segment https://codeigniter4.github.io/userguide/incoming/routing.html#uri-segments
Ex: mywebsite.com/ci4app/home/participantlogin
Controller or its method is not found: AppControllersCi4app::home
CI thinks "ci4app" is the controller, it is really "home", it seems like I should just update a baseurl somewhere
Messed with .env, config file, .htaccess and apache config.
Folder Structures
/var/www/html/ – WordPress Site
/var/www/html/myapp – CI4
2
Answers
Make sure the baseURL is set correctly. The sub-directory must appear in the baseURL (in .env file or app/Config/App.php). For example if CI is in a directory called ci4app, then the baseURL should be http://urltoserver/ci4app/
For .htaccess modifications, this gist could be helpful.
Check for CamelCase spellings… home should be Home <– Notice Capital "H"
You also have a Capital "C"
This should match exactly what you have in your controller, Example:
In your case it should look like this:
And check your Route as well to ensure it is going to the right place:
When someone types in domain.com/ci4app it will route internally to home Controller -> ParticipantLogin Method
Good Luck, Happy Coding!