Codeigniter: URI you submitted has disallowed characters

Codeigniter: URI you submitted has disallowed characters

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

The = Character in CodeIgniter URIs and Why Configuration Alone Isn't Enough

When your application throws "The URI you submitted has disallowed characters," the immediate instinct is to expand the $config['permitted_uri_chars'] whitelist in your application/config/routes.php. You might see a URL like https://example.com/c3dlZXRfcmFqdmk5MUBob3RtYWlsLmNvbQ= and realize that removing the trailing = fixes the issue. Adding = to the permitted characters list seems like the logical next step, but this specific scenario exposes a fundamental misunderstanding of how CodeIgniter processes URLs before they even reach your configuration logic.

The error occurs because the permitted_uri_chars setting only filters characters present in the raw URI string after URL decoding, but it does not account for the fact that the equals sign (=) often has a specific meaning in the context of Base64 encoding or query strings. However, the real issue here is likely that the URL you provided is actually a fragment identifier or a direct path containing raw Base64 data, which CodeIgniter's routing engine handles differently depending on how the framework is configured to parse segments.

If your goal is to allow = in the URI, simply appending it to $config['permitted_uri_chars'] works in many cases, but there are nuances you need to understand regarding URL encoding. The character = is a valid part of a URI, often used to separate key-value pairs in query strings (e.g., ?key=value) or as padding in Base64 data. When CodeIgniter loads its configuration, it checks the URI against this regex pattern. If the pattern does not include =, the router throws an exception immediately.

Here is how to correctly configure this:

// application/config/routes.php (or wherever your config lives)
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=';

By adding = to the end of the string, you explicitly tell CodeIgniter that this character is acceptable in the URI path. However, if you also need to allow ==, you must include it: '...==='.

The Base64 Trap

Your example URL decodes to a string resembling an email address (c3dlZXRfcmFqdmk5MUBob3RtYWlsLmNvbQ= decodes to something like welcome9@hotmail.com=). This suggests you might be trying to use the URI path itself as a data payload, possibly for a Base64-encoded redirect or session token.

While allowing = solves the immediate configuration error, relying on raw Base64 in the URI path is often an anti-pattern. Browsers and proxies sometimes mishandle these characters, and they can interfere with standard routing mechanisms that expect clean segment names. If you are using this for a specific feature (like a one-time password or a redirect token), ensure that your controller logic explicitly handles the decoding safely before attempting to use the data.

Query Strings vs. URI Paths

It is crucial to distinguish between the URI path and the query string. The permitted_uri_chars setting applies to the path (the part after the domain, before the ?). If you are appending parameters like &token=abc, those characters are handled by a different mechanism.

If your intention is to allow complex data in the URL for security tokens, consider whether moving that data into a query string parameter is more robust than embedding it directly in the path. Query strings are generally more forgiving of special characters and do not require modifying the permitted_uri_chars whitelist unless you are dealing with encoded values within the path segments themselves.

Security Considerations

Expanding the allowed character set increases the attack surface slightly. While = is a standard reserved character, allowing unusual patterns can sometimes lead to confusion between routing logic and user input. Always ensure that any URI segment containing special characters is strictly validated on the server side before processing. Do not assume that merely whitelisting a character in the config file makes the entire request safe; you must still sanitize the data extracted from it.

If your project requires a more flexible approach to URL handling, or if you are migrating logic from one framework to another, remember that Laravel offers similar configuration options via php artisan route:list and the $routeMiddleware stack, which can be more granular in handling specific character restrictions. For example, seeing how Laravel handles URI filtering might provide insight into whether your CodeIgniter setup needs a middleware layer to intercept these requests before they hit the router.

Ultimately, adding = to the whitelist is the correct technical fix for the immediate error, but understanding why that character is restricted and where it appears in the request lifecycle ensures you aren't opening unintended vulnerabilities while trying to support Base64-encoded paths.

Our network