Sometimes you may have the need to run codeigniter inside of another application, I often do this for client work when I need to install multiple codeigniter instances on my development server. This can cause nightmarish consequences and many hours of running around in circles if this isn’t done correctly.
Initially deploying the application is fine but you must ensure that the url of the codeigniter subfolder is entered directly and does not match any existing routes in your main application. It may be necessary to add a htaccess in to your sub-application that allows access to that folder.
The important thing is to set the base_url in the config file for your Codeigniter application :
$config['base_url'] = 'http://www.example.com/testsite/';
You may then have issues with relative links inside your child application, the solution to this is to set the base href in the header of each page of the sub-application
<base href="<?php echo base_url();?>"/>