Question: I have problem making CodeIgniter pagination when i click on link i get 404 page not found
my code in controler is

```
class Records extends CI_Controller 
{
    public function index()
    {   
        $this->load->library('pagination');
        $config['base_url']= 'localhost/records';
        $config['total_rows']= $this->db->get('pages')->num_rows;
        $config['per_page']= 2;
        $config['num_links']= 5;
        $this->pagination->initialize($config);
        $data['query'] = $this->db->get('pages',$config['per_page'],$this->uri->segment(2));

        $this->load->view('view_header');
        $this->load->view('includes/nav_home');
        $this->load->view('view_list', $data);
        $this->load->view('view_footer');

```

}

i tried diffrent uri segments, but still no result. ? I am writing code in right way. my base\_url is empty in config file?

in view my code is

```
<?php
echo $this->session->flashdata('item');
echo '<h4>Lista podataka</h4>';

foreach ($query->result() as $q):

?>
<a href="/z/update/grab/<?php echo $q->id;?>/<?php echo $q->info; ?>"><?php echo $q->info . br() . br()?></a>
<?php 
endforeach;

echo $this->pagination->create_links();
?>

```

Answer: 
As far I understand you can't access your next page pagination? So I think it's because of this `$config['base_url']= 'localhost/records';`

you should put your complete url(including the controller name and function name), so it should be

`$config['base_url']= 'localhost/records/index.php/controller_name/function';`

and in your uri segment should `$this->uri->segment(3)`
Base url in must be contain the same function that is used to fetch data
 it means $config['base\_url']='localhost/project/records/index';