views:

123

answers:

3

Hey SO,

I'm having a little trouble with a CodeIgniter route when there is a query (stuff after the ?) in the URI. I know it is good practice to replace queries with routes in CI, but I'm importing in a premade messageboard that already does everything with queries. This is my route:

$route['messageboard/:any'] = "messageboard/index";

Any in this case refers to a script name. So if it's messageboard/admin.php, I have it load a view that loads my premade messageboard's script "admin.php". It's working just fine if I do messageboard/admin.php. It does fine if I do messageboard/admin.php?. If I put a parameter into the query, however, the route won't correctly send the user to the messageboard controller, and instead sends them to a 404. Does anyone have any ideas on how to make this work? I would be eternally grateful. Thanks!

A: 

I believe CI doesn't do GET out of the box. Check out Enabling Query Strings here http://codeigniter.com/user%5Fguide/general/urls.html

mtvee
A: 

I'm sure the syntax is:

$route['messageboard/(:any)'] = "messageboard/index"; //<-- notice brackets

and not

$route['messageboard/:any'] = "messageboard/index";
pǝlɐɥʞ
I think they do the same thing. I tried it. Thanks though!
Ethan
learn something new everyday :-)
pǝlɐɥʞ
A: 

Okay guys, I solved it. I needed to change three things. The first was mtvee's suggestion, which lets it read query strings. The second one you're going to want to change the $config['permitted_uri_chars'] in the config file to include an equals sign, since it starts off disabled and all query strings will be of the for ?a=34 or something like that. The third is you need to go to $config['uri_protocol'] and change it from AUTO to PATH_INFO. Once I did those, it worked.

Ethan