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 *


three + = 12

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>