Welcome Guest, Not a member yet? Register   Sign In
Pagination Throws HTTP Error 404 only on webserver not in localhost
#1

[eluser]Unknown[/eluser]
Hello Guys,

I am using CodeIgniter 1.7 and I am facing problem with Pagination.

I was implement pagination successfully and tested it perfectly in my localhost. But when

I was upload all files on my webserver at that time I found errors when I am trying to access different pages from the footer links.

Following are my piece code for pagination.
Code:
$this->load->library('pagination');

$config['base_url'] = base_url().'index.php/training/index/';
$config['total_rows'] = $this->db->count_all('training');
$config['per_page'] = '5';
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';

$this->pagination->initialize($config);

$offset    = (int)$this->uri->segment(3);
$offset = ( ! is_numeric($offset) || $offset < 1) ? 0 : $offset;

For live link for the pagination you can checkout below mentioned link.

http://www.iamkrunaltrivedi.com/index.php/training

I was try out lots of things but not able to get solution for it.

Please help me to solve this problem. If you need any extra information then please let me know about it.

Thanks,
Rushit Shukla
[email protected]
http://www.AavidTechnologies.com
#2

[eluser]petroz[/eluser]
Just force the uri to redirect to index/0 if the pagination offset uri is empty. Like so

if(empty($this->uri->segment(3))
{
redirect('training/index/0');
}

I really wouldnt use the index method for this... always try to use a second method... I find them easier to manage.




Theme © iAndrew 2016 - Forum software by © MyBB