[eluser]Unknown[/eluser]
I ended up on this thread while searching for how to get querystring support in my app. Search is the easy, obvious example of where querystring-based approaches are more elegant, but there are many other usecases, such as needing to receive oauth callbacks from other sites, etc. Furthermore, any good search url on a site should be usable directly from the address bar given you know the params, a la ?q=myquery&page=1. This is a de-facto standard, and IMO everyone should use it in the absence of a compelling reason otherwise.
I think a good portion of the confusion surrounding this issue could be cleared up by providing better implementation details than simply saying "it's a setting, just turn it on."
My app needed twitter oAuth support, and my experience was that turning on querystrings in CI is a 3-step process:
1) enable query strings in config:
Code:
$config['enable_query_strings'] = TRUE;
2) use PATH_INFO for routing
Code:
$config['uri_protocol'] = "PATH_INFO";
3) update .htaccess
This is what I was missing in the other examples I found. The default .htaccess I had sends the whole uri path as a get string, so
Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]
just needs to be changed to
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]
in both rewrite rules.
After making those changes, I was able to keep my path-based routes intact, and access get vars through $this->input->get() with no problems.
Hope this helps save someone some time. It probably won't work on non-Apache-like servers, but as most of us are using Apache, should be helpful for most.