Can someone please clarify the querystring fix thing? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Can someone please clarify the querystring fix thing? (/showthread.php?tid=45615) |
Can someone please clarify the querystring fix thing? - El Forum - 09-28-2011 [eluser]w1ntermut3[/eluser] So: 1. I've got htaccess rewriting my urls to remove the 'index.php' part. 2. I'm using CI 2.02. I want to use combined url segments with querystring values, so I can do: http://www.mysite.com/controller/function/?foo=bar I've just spent an hour reading a couple of huge threads on here. I'm none the wiser. To clarify what I've done so far, and for the benefit of anyone else who's as confused as I am: This suggested solution - from 2009 - does still seem to work, in part: http://www.askaboutphp.com/58/codeigniter-mixing-segment-based-url-with-querystrings.html To wit, this solution involves: 1. In config.php, change uri_protocol to PATH_INFO 2. In config.php, change enable_query_strings to TRUE 3. In htaccess, change any instance of "index.php?/$1" to "index.php/$1" However, this puts question marks on my URLs. As in, site_url('/about_us') now returns "http://www.mysite.com/?/about_us". This results in a redirect loop for me, and bascially doesn't work. There is another posted solution, at: http://ellislab.com/forums/viewthread/159382/P30/#780670 However, it seems to just consist of some code to paste into a new file at /applications/libraries/MY_Input.php Code: <?php I guess it was assumed that anyone smart enough to need to use this fix, was smart enough to figure out how. Unfortunately, I'm not. Specifically, I'm confused regarding: 1. Having created it, do I have to add this new file to my list of libraries in autoload.php? If not, how does it get included? 2. How do I use it? That is; will querystring variables now be available via $_GET, or $this->input->get, or both, or something else? 3. What should my config settings be with this approach? As per the first 'fix', I'm currently enabling query strings and using PATH_INFO as my uri_protocol. Should these be different? Should anything else in config.php be different? 4. Does my htaccess need (a) leaving as it is, (b) reverting to contain question marks, or © something else? Finally... just... WTF? Querystrings should work. Out of the box, they should just work. |