I see, learn and rediscover… everyday!
Query String in URL using Codeigniter

Query String in URL using Codeigniter

CodeIgniter by default won’t allow you to use query strings in the URL.

This is how you enable query string in url in codeigniter.

1. Set $config[‘uri_protocol’] = “PATH_INFO” in config.php

2. Set $config[‘enable_query_strings’] = TRUE in config.php

3. Make you sure you have QSA in your .htaccess. For example,

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|includes)
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

Note: If you make these changes, the pagination module is affected. So, if you had implemented any pagination before changing these settings, you might want to check them again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.