```
$route['allgrant'] = "grant/allgrant";

```

The above is working fine for the URL: <http://localhost/grant/allgrant>

But I am getting error with URL <http://localhost/grant/allgrant/6>

My route setting is below:

```
$route['allgrant/(:num)'] = "grant/allgrant/$1";

```

My controller code:

```
public function allGrant()
{
    $this->load->library('pagination');
    $config = array();
    $config["base_url"] = base_url('allGrant');
    $config['total_rows'] =   $this->db->count_all("grant_data");
    $config['per_page'] = 3;
    $config["uri_segment"] = 2;
    $this->pagination->initialize($config);
    $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;
    $data["allGrant"] = $this->grant_model->allGrant($config["per_page"], $page);
        $data["links"] = $this->pagination->create_links();
    $data['mainContent'] = 'viewGrant';
    $this->load->view('include/template',$data);
}

```

when I load the all grant page it show me the first three result but when I click on the pagination it give error with page not found