I just managed to route to the controller in the subfolder after i got this solution. Everything works fine when on local computer. When run on hosting, the "404" error message appears.
I'm just newbie, don't know where missed
Here some info :
Local : Apache 2.4.34; PHP 5.6.38
Hosting : Apache 2.4.35; PHP 5.6.38Local address : hris.localhost.co.id
Live address : hris.sbmgrp.co.id
Here my folder
- public html
|-- hris <-- **subdomain folder**
| |-- application
| | |-- controllers
| | | |-- user
| | | | |-- Auth.php
| | | | |-- Dashboard.php
| | | |-- Welcome.php
| | |-- core
| | |-- MY_Router.php
| |-- .htaccess
|-- helpdesk <-- other subdomain
| |-- .htaccess
|-- .htaccess.php
MY_Router.php sames as this.
.htaccess (hris)
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /hris/
# If your default controller is something other than 'welcome' you should probably change this.
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
SetEnvIfNoCase X-Forwarded-For .+ proxy=yes
SetEnvIfNoCase X-moz prefetch no_access=yes
# Block pre-fetch requests with X-moz headers.
RewriteCond %{ENV:no_access} yes
RewriteRule .* - [F,L]
# Fix for infinite redirect loops.
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [L]
</IfModule>
.htaccess in public_html
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
When i try set $router[default_controller] = 'welcome' , its works normally. If any other issue please let me know. Thanks for your advice.