CodeIgniter Forums
how to use $config['uri_protocol'] = "PATH_INFO"; with nginx server - 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: how to use $config['uri_protocol'] = "PATH_INFO"; with nginx server (/showthread.php?tid=42383)



how to use $config['uri_protocol'] = "PATH_INFO"; with nginx server - El Forum - 06-06-2011

[eluser]nil_php[/eluser]
Hi friends,

I am facing problem with nginx server.
I want to use $config['uri_protocol'] = "PATH_INFO"; but when I am using this it is showing me 404 error message. It is working with $config['uri_protocol'] = "REQUEST_URI";

But my few urls are like site.com/search/?a_aid=123456 for tracking a_aid on some other sites I need such urls.

If I used the site.com/search/?a_aid=123456 such url with $config['uri_protocol'] = "REQUEST_URI"; then it is showing the message "The URI you submitted has disallowed characters."

Can anyone help me to find out how to use PATH_INFO as uri_protocol or site.com/search/?a_aid=123456 with nginx.


how to use $config['uri_protocol'] = "PATH_INFO"; with nginx server - El Forum - 06-07-2011

[eluser]nil_php[/eluser]
This issue is solved now.
Go to system/libraries/URI.php & replace the line

Code:
if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))

with

Code:
if ( ! preg_match("|^[".($this->config->item('permitted_uri_chars'))."]+$|i", rawurlencode($str)))

Also change the permitted_uri_chars value in config.php to
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

And use the uri_protocal as,

Code:
$config['uri_protocol'] = "REQUEST_URI";