Reputation: 7109
I have configured a route in routes.php
as:
$route['job-history/(:num)'] = "customer/customer/jobhistory/$1";
And pagination configuration in controller as follows:
$this->load->library('pagination');
$config['per_page'] = 25;
$config['total_rows'] = 100;
$config['base_url'] = $this->config->item('base_url').'job-history';
$config["uri_segment"] = 2;
$this->pagination->initialize($config);
$page = ($this->uri->segment(2)) ? $this->uri->segment(3) : 0;
It is showing 404 error page while loading: www.example.com/job-history
It will work if manually add a zero like: www.example.com/job-history/0
How can I load www.example.com/job-history
as the first page? What is wrong in my configuration?
Upvotes: 1
Views: 5952
Reputation: 6860
Since, in route.php, you have only mentioned for job-history pages that has a number segment after it and there is no such rule for your page job-history only, it gets redirected to 404.
Add
$route['job-history'] = 'customer/customer/jobhistory';
before
$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1';
Upvotes: 2
Reputation: 13447
You'll need a route for the single job-history
segment as well.
$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1';
$route['job-history'] = 'customer/customer/jobhistory';
Upvotes: 12