CodeIgniter Forums
The URI you submitted has disallowed characters. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: The URI you submitted has disallowed characters. (/showthread.php?tid=21342)

Pages: 1 2


The URI you submitted has disallowed characters. - El Forum - 08-06-2009

[eluser]verynewtothis[/eluser]
It works when I keep index.php in my path:
Code:
http://mywebsite.com/CI-Directory/index.php/process?param=0&param2=4

But without index.php included, this generates error
Quote:The URI you submitted has disallowed characters.

it's just one URL where I require the query string parameters. The site otherwise runs fine in the example.com/class/function/ID URL format.

my htaccess file has this:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /CI-Directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /CI-Directory/index.php/$1 [L]
</IfModule>

The config.php file has:
Code:
$config['uri_protocol']    = "AUTO";
$config['enable_query_strings'] = FALSE;

I am using CI 1.7.1 with URI.php updated from:
Quote:http://dev.ellislab.com/svn/CodeIgniter/trunk

Hope I get some help here.
Thank you


The URI you submitted has disallowed characters. - El Forum - 08-06-2009

[eluser]bretticus[/eluser]
You cannot combine segment based uri with querystring. If you turn on query strings via:

Code:
$config['enable_query_strings'] = TRUE;
You must set your controllers and methods via query string too.

CI Urls

I've never tried this but you *might* be able to accomplish this with routes.

URI Routing


The URI you submitted has disallowed characters. - El Forum - 08-06-2009

[eluser]verynewtothis[/eluser]
I believe one can use both... as this URL "WORKS FINE" when I have index.php in it. It gives this error only when the index.php is not used in the URL (htaccees rewrite kicks in).. So it makes me to believe that this is something to do with my instructions in .htaccess file.


The URI you submitted has disallowed characters. - El Forum - 08-07-2009

[eluser]bretticus[/eluser]
Your index.php works fine most likely because your rewrite rule in your .htaccess is setup to not redirect real files and index.php is a real file. Like you say, it's only after your .htaccess file kicks in. Though I wonder why CI ignores $config[‘permitted_uri_chars’] only when index.php (I haven't tested this myself just going off your assurance) is in the URL.

Speaking of $config[‘permitted_uri_chars’], you can certainly try adding '?' and '=' to it under "Allowed URL Characters" in yout config.php file.

If it were me, I'd just send the arguments as segments. (ie. http://mywebsite.com/CI-Directory/process/0/4 )


The URI you submitted has disallowed characters. - El Forum - 08-07-2009

[eluser]verynewtothis[/eluser]
These query string variables are "RECEIVED" on this script/URL from a 3rd party system (beyond my control). So I can't change much (i.e changing to segment based parameters as you suggested).

I will try your other suggestion - adding "?" and "=" to the "Allowed URL Charterers"

So I guess I'll have to change the "permitted_uri_chars" to this?

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?='; //Added '?' and '=' at the end

Appreciate your help


The URI you submitted has disallowed characters. - El Forum - 08-07-2009

[eluser]verynewtothis[/eluser]
Still seeing the same error. This is what I did.

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\?=-'; //Added '?' and '='



The URI you submitted has disallowed characters. - El Forum - 08-07-2009

[eluser]Phil Sturgeon[/eluser]
Holy Duke Nukem I can't believe how often this question is asked.

http://ellislab.com/forums/viewthread/99570/


The URI you submitted has disallowed characters. - El Forum - 08-07-2009

[eluser]verynewtothis[/eluser]
Thanks for the link..

The site is now giving:

Quote:404 page not found

I assume this is strictly related to my htaccess rewrite rules?
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /CI-Directory
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /CI-Directory/index.php/$1 [L]
</IfModule>



The URI you submitted has disallowed characters. - El Forum - 08-07-2009

[eluser]verynewtothis[/eluser]
I really hope someone can help me in fixing this issue. What sort of changes do I need to make to my htaccess file to get things on track?

Really appreciate all your help.

Thank you


The URI you submitted has disallowed characters. - El Forum - 08-08-2009

[eluser]verynewtothis[/eluser]
I have tried many changes on config.php and htaccess file ..here are my observations.

My site works with:
Code:
$config['uri_protocol']    = "AUTO";

and gives 404 errors with:
Code:
$config['uri_protocol']    = "PATH_INFO";

the trouble maker URL:
Code:
http://mywebsite.com/CI-Directory/process?param=0&param2=4
gives 404 error with:
Code:
$config['enable_query_strings'] = TRUE;

when I set enable_query_string to "FALSE", I get the dreaded
"The URI you submitted has disallowed characters." error..

Interestingly enough this works perfectly with "index.php" INCLUDED in the URL..

Hopefully some one could find a clue out of my above observations and can provide some pointers towards solution.

Thanks.