I have this login page as the default controller in the routes page.When users logs in the system they should select the view they want.
login Home Page
<div class="form-group">
<select class="form-control" name="system" required>
<option value="">--SYSTEM SELECT--</option>
<option value="malaria">Malaria</option>
<option value="familiy">Familiy Planning</option>
<option value="lab">Laboratory</option>
</select>
</div>
Login Controller
if($system=="malaria") {
//redirect to malaria controller
redirect(base_url().malaria);
}else if($system=="familiy"){
//redirect t family planning controller
redirect(base_url().family);
}
else if($system == 'lab'){
redirect(base_url().lab);
}else{
redirect(base_url());
}
function logout(){
$this->session->sess_destroy();
redirect(base_url());
}
Each of the controllers in the login controller works perfectly. when you load the page for the first time it selects the controllers, but when the user logs out the system doesn't select the system anymore, it loads the default controller
config.php
$config['base_url'] = 'http://localhost/trial/';
$config['index_page'] = '';
routes.php
$route['default_controller'] = "login";
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
So when the user logs out the system should take them to the base_url.
Which is the login page. The error is when the user logs out and wants to log in and selects the same view or any other view the system still loads the base_url().