3

I want to change codeigniter pagination query string. Currently this is working like below example

http://example.com/1

I want to change this with my example like

http://example.com?page=1

Anyone can let me know how I can do this without changes in existing library? or Should I have to create my own pagination for this system?

Thanks

3 Answers 3

3

You have to set config for pagination

$config['page_query_string'] to TRUE

you also can configure your querystring

$config['query_string_segment'] = 'your_string';
Sign up to request clarification or add additional context in comments.

Comments

2

Actually with CodeIgniter 3.0.0 there is a better solution now;

You should enable the reusage of the query string buy enabling this configuration:

$config['reuse_query_string'] = true;

only after that you should initialize the pagination:

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

Comments

0

You can do it by using 'Enabling Query Strings' in /application/config/config.php

$config['enable_query_strings'] = TRUE;

But, it will also add controller and method names as query stings not as clean urls like:

index.php?c=controller&m=method

Reference

1 Comment

I have to make change only in pagination not in whole site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.