You can make use of _remap() function of controller for dynamic routing
https://www.codeigniter.com/userguide3/general/controllers.html#remapping-method-calls
For more details, you can refer the following example:
http://www.web-and-development.com/codeigniter-remove-index-php-minimize-url/
4
solved CodeIgniter routing as subfolder