controller:Test.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Test extends CI_Controller
{
function __construct()
{
parent :: __construct();
$this->load->helper(array('form', 'url', 'captcha', 'email', 'html'));
}
public function study_abroad()
{
$data['student_id'] = $this->session->userdata('student_id');
$this->load->view('study-abroad',$data);
}
}
view:
<a href="<?php echo base_url(); ?>study-abroad">Study Abroad</a>
route.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$route['default_controller'] = 'test';
$route['404_override'] = '';
$route['translate_uri_dashes'] = TRUE;
$route['(:any)'] = "colleges/index/$1";
$route['college/(:any)'] = "test/college/$1";
$route['study-abroad'] = "test/study_abroad";
In this code, I have created a controller having name Test.php where I have load a view file having name study-abroad. Now, I want to remove controller name i.e. Test from my URL. I have defined the path of study abroad in my route file and delete controller name from view file but it redirects me to the wrong page. If I put controller name before view file it will redirect me the actual page. What is the problem behind this?