RNK
RNK

Reputation: 5792

Codeigniter: URI you submitted has disallowed characters

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

Upvotes: 41

Views: 137902

Answers (8)

Joe Edman
Joe Edman

Reputation: 11

In CodeIgniter 4:

Update app/Config/App.php and set update this line:

public string $permittedURIChars = 'a-z 0-9~%.:_\-';

A full list of Unicode ranges can be found at Wikipedia’s Unicode block.

See more in CI4 manual.

Upvotes: 0

sam nikzad
sam nikzad

Reputation: 1360

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 :

https://avasam.ir/product/34/digikala-course-with-laravel-and-kotlin

.

Upvotes: 1

Zulficar Hasan Joy
Zulficar Hasan Joy

Reputation: 39

I have changed the config.php file

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

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

and

$config['enable_query_strings'] = TRUE;

Upvotes: 1

amba patel
amba patel

Reputation: 424

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

Upvotes: 5

Angel Doza
Angel Doza

Reputation: 1134

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

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

it also works for @ character

Upvotes: 78

mohammd salman
mohammd salman

Reputation: 21

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)); 

Upvotes: 2

Abhijeet Navgire
Abhijeet Navgire

Reputation: 753

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!

Upvotes: 11

Deepu Bhasin
Deepu Bhasin

Reputation: 181

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

Upvotes: 2

Related Questions