In CodeIgniter it’s really tricky to combine URI segments and Query strings at the same time.
One of the traditional ways to almost achieve that is by enabling enable_query_strings.
The issue is that this has some weird behavior and it affects all the URL helpers as well.
By example when using: redirect('/home') it redirects to domain.com/?/home.
Based on my knowledge, enable_query_strings is not meant to be used with URI segments.
So how to extend the core to enable both GET and URI out of the box?
P.S. I know that it’s better to just use URI segments, but it’s very important sometimes to accept GET queries like from adwords.
The best solution is this:
enable_query_strings(it’s not what you want)allow_get_arraytoTRUE, which will allow you to use$_GETuri_protocolsetting until you find one that works for your environment,PATH_INFOworks for me.enable_query_stringsbreaks almost all the functionality that makes Codeigniter great, including all the helper functions that deal with urls. It was some experimental feature that has been confused with normal query string support for as long as CI has been around.Bottom line – just upgrade (if you haven’t already) and don’t try to write a hack for it.