I want to pass parameters to index function and if the parameter is not, redirect to home page. i added custom route also. where did i miss the code?
$route['main/(:any)'] = 'main/index/'; // looks like has a mistake
www.example.com ->when deafult index function
www.example.com/females ->when deafult index has string parameter 'female'
class Main extends CI_Controller {
public function index($gender) {
load->view('inc/header_view');
if((isset($gender)) && ($gender =='female')){
$this->load->view('female_view');
} else {
$this->load->view('female_view');
}
}