Error: "URI you submitted has disallowed characters" in Codeigniter.

Error: "URI you submitted has disallowed characters" in Codeigniter.

What is CodeIgniter?

CodeIgniter redefined web applications. This PHP framework was developed by Ellis lab which was praised by PHP creator as the least like a framework. CodeIgniter framework designed with hypertext preprocessor PHP with a very small footprint is used for developing quality websites. The open source software with rapid development PHP framework released in 2006 is faster and lighter compared to the other frameworks. Licensed by MIT it is also highly rated by Google. The founders Ellis Lab for the successful running of the framework took the stewardship of the British Columbia Institute of technology who became the new developers since 2014.
  • MVC Pattern :
CodeIgniter has the popular MVC pattern. The model-view-controller pattern with the model and view as options and the controlling part as the main function makes is the best framework available for its speed and control. MVC is a unique software approach that separates presentation from application logic. This allows minimal scripting because the presentation is separate from the PHP scripting. The model representing the data structures helps in inserting, retrieving and updating information in the data pages. The view in the MVC pattern of CodeIgniter will allow seeing not only the webpage but also any type of pages like a header and footer.
  • CodeIgniter Controller :
The Controller functions to generate a web page serving as an intermediary between the model and view. This helps in processing the HTTP request and creating the required web page. The controller is a simple class file and controls the whole application of URI. The controlling part also brings in the error problems of which ‘The URI you submitted has disallowed characters'. These are commonly called CI errors. This happens when the CodeIgniter does not allow certain characters. The controller function of the CodeIgniter only allows a few characters and leaving a blank for all characters is insane. The errors displayed in the developing stage than the production stage can be easily solved. The CodeIgniter provides an easy error handling mechanism.
  • Why we are getting this error?
CodeIgniter has its own strict policy in which characters are not allowed in URLs. That is the main reason error "The URI you submitted has disallowed characters." displays. CodeIgniter restricts characters in URI string to minimize the chances of malicious attack by passing the data to your application.
error.png

URI can only contain following:
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
  • How to solve this error?
In CodeIgniter 2.1.x version the common error is ‘The URL you submitted has disallowed characters'. The safe way of solving this error is making a few changes in line 156 $config { ‘permitted_uri_chars' } = ‘a-z 0-9~%.:_+;' to :
Code:
$config { ‘permitted_uri_chars' } = ‘a-z 0-9~%.:\_\=+%\&';
To rectify this error go to page 129 of application/config/config.php file where you have to change the following $config { ‘permitted_uri_chars' } by adding a comma and save the file and refresh the browser. This will solve the issue but strictly to be done only understanding the repercussions. This could also be done with adding # before.
Code:
#$config { ‘permitted_uri_chars' }.
The most important thing to solve this error is to identify the character to be included in the array of the URI string.
  • CI htaccess File :
CodeIgniter htaccess or the CI htaccess file enables in solving errors of using CodeIgniter framework. CodeIgniter allows all requests to use the front controller because of mod_rewrite. Some additions to the URI endpoints to canocalize they will enable the search engine page ranking to one page than several pages.
Author
bhawanisingh
Views
23,279
First release
Last update
Rating
0.00 star(s) 0 ratings
Top