CodeIgniter Forums

Full Version: Passing $_GET to controller unexpeacted error.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]arbme666[/eluser]
Hi,

When I go to a url say index.php/foo? is will load the page fine but if I go to index.php/foo?bar it will load my default controller.

I am a bit confused I thought you could pass GET vars or I would expect it to through a 404 error.

Any ideas

El Forum

[eluser]ChrisMiller[/eluser]
It is not hard to setup

First open up /system/application/config.php

Change
Code:
$config['uri_protocol']    = "AUTO";
To:
Code:
$config['uri_protocol']    = "PATH_INFO";

and then open up your index.php file and add near the top of the file
Code:
parse_str($_SERVER['QUERY_STRING'],$input_vars);

Special notice is $input_vars is not safe from sql injection etc... it basically gives you exactly what was inputed you must sanatize this manually via... $this->security->xss_clean()

http://ellislab.com/codeigniter/user-gui...urity.html Wink

you may have to also do the Url Suffix as well as its been awhile since I did this trick but that would be the variable
$config['url_suffix'] in the same config file just below the uri_protocol.