php – Codeigniter: URI you submitted has disallowed characters-ThrowExceptions

Exception or error:

My URL is:

https://example.com/c3dlZXRfcmFqdmk5MUBob3RtYWlsLmNvbQ=

When I remove = then it works fine.

I have this in config.php

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

Error:

The URI you submitted has disallowed characters.

How can I allow = or == signs in URI?

I have tried it by changing this:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-='; // added = sign at the end
How to solve:

In /project-folder-name/application/config/config.php configure this variable:

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

it also works for @ character

Answer:

change in config.php file

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

and

$config['enable_query_strings'] = TRUE;

It works for me. Try it yourself!

Answer:

In CI open directory at
project-folder-name/application/config/config.php and configure the variable $config['permitted_uri_chars']:

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

This will work for all special characters

Answer:

i have got this in address bar

O9SPVKocvz6Ph7mT+ulXzMhYV2VDao5gfL9BWtdMKdOBL4PnSLc5E8nIBYnj4hdTpaBUUgFmMX+3X24CfzZ3Rw==

change in config.php file

use this

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

its working fine

Answer:

first of all you have to encode your id that is pass in url, then in controller you have to decode the id.
view:

<a href="<?php echo base_url()?>Cinvoice/imei_invoice/<?php echo base64_encode($invoice_list['invoice_id']); ?>" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="left" title="Final Invoice By Ware House">Primary Order</a>

Controller:

when you call fuction that is in library

$content = $CI->linvoice->get_imei(base64_decode($invoice_id)); 

Answer:

In my CI version 3.11 i solved by this :

in application/config/config.php i changed

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

to

$config['permitted_uri_chars'] = '';

and problem solved.

My URL was something like this : example.com/product/45/kotlin_toturial(by_avasam.ir) _in_99_lessons

.

Leave a Reply

Your email address will not be published. Required fields are marked *