CodeIgniter Forums
Question on URI Query Strings - 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: Question on URI Query Strings (/showthread.php?tid=12974)



Question on URI Query Strings - El Forum - 11-06-2008

[eluser]jamie young[/eluser]
If I understand correctly, by default CI has query strings disabled by default, preferring you to use something like http://domain.com/class/function/id. If I want to use something like http://domain.com/class?product=2 I would need to set enable_query_strings to TRUE in config.php and do something like http://domain.com/index.php/c=class&m=method&product=2.

I have noticed you can get around this if you have 2 query strings in your URL though.

Example. If I do http://domain.com/login?.done=http://google.com I get a 404, page not found, however if I do http://domain.com/login?.done=http://google.com&a the page displays properly and if I dump out $_REQUEST it will show _done and a.

Is this a feature I have not read about? or should that not be working w/out enable_query_strings set to TRUE?


Question on URI Query Strings - El Forum - 11-06-2008

[eluser]drewbee[/eluser]
Hmm. I cannot replicate this.


Question on URI Query Strings - El Forum - 11-06-2008

[eluser]jamie young[/eluser]
To reproduce, take a fresh install of 1.7.0 and go here

http://localhost/CodeIgniter_1.7.0/index.php/welcome?a

you will get 404, at least I do

then try

http://localhost/CodeIgniter_1.7.0/index.php/welcome?a&b

You will get the welcome page


Question on URI Query Strings - El Forum - 11-06-2008

[eluser]sophistry[/eluser]
i assume that you mean "query contains two GET variables" not "2 query strings in your URL"

i can see what you are talking about... 1st URL triggers 404, but second doesn't and the REQUEST superglobal holds two keys.

_done (yes, _done with an underscore and not a dot - bizarre)
and
a.

query strings are FALSE and the URL populates _REQUEST, but not _GET ...

could this be related to the mysterious and intermittent "dots turn into underscores" problem?


Question on URI Query Strings - El Forum - 11-06-2008

[eluser]jamie young[/eluser]
I don't mind the . turning into an _, I can deal with that, I just need to understand why 2 variables passed in the URL work but one variable only triggers the 404.

Ideally, I want to use domain.com/login?.done=url. I don't need a 2nd variable just so the page will not show a 404.


Question on URI Query Strings - El Forum - 11-06-2008

[eluser]sophistry[/eluser]
i'd suggest posting this in the bug forum with some sample code.