Fixed: “The URI you submitted has disallowed characters.” CodeIgniter (CI) Error

In codeigniter 1.7.x version if you find “The URI you submitted has disallowed characters.” message then you can solve it easily by following the below steps.

Follow the following ways to fix this error. (assuming codeigniter 1.7.x)

1) in codeigiter system/libraries open URI.php line 189 you’ll find

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

change this code by

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

2. Now another changes in your system/application/config/config.php file. Go to the line 126

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';

change this code by

$config['permitted_uri_chars'] = 'a-z 0-9~%\.\:_\-';

After changes the code, save the file and refresh your browser.

Comments (8)


  1. DDR Media says:

    Thank you! After searching many forums, and getting input from the person who originally wrote this program and the hosting service (none of which worked), THIS finally fixed the issue. Thank you so much again.

  2. suneel says:

    What about the same problem in 1.5.4 version

  3. James says:

    Just a quick note to say thank you! You’re an internet hero for publishing random little fixes like this.

  4. Rajib says:

    Dear admin,
    I am using the latest 2.1.3 version and getting the same error. i found the URI.php file but there is no code if ( ! preg_match(“|^[“.preg_quote($this->config- ….
    Now please help me how to solve this problem.

    Thanks in advance

  5. Marius says:


  6. Kamy says:

    Thanks it was great solution.

Leave a Reply