Welcome Guest, Not a member yet? Register   Sign In
Bluehost and GET parameters
#1

[eluser]jiffier[/eluser]
Hi all, I have an application deployed on Bluehost but I'm facing the problem of accessing request parameters:
While testing on my local box, I was using PATH_INFO.
But PATH_INFO on bluehost doesn't seem to work (always gets the default controller). Here is my .htaccess file:

Code:
AcceptPathInfo On

RewriteEngine on

RewriteBase /
RewriteRule ^$ /index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [QSA,L]


If I use uri_protocol=AUTO then it gets the controllers correctly, but a URL containing parameters throws an error:

Code:
The URI you submitted has disallowed characters.

If I set it to ORIG_PATH_INFO, then any request makes an infinite redirect.
If I set it to REQUEST_URI or QUERY_STRING, I get the same as AUTO.

I'm running out of ideas, has anyone suceeded in reading request parameters under C.I at Bluehost?

Any help appreciated, thanks!

--
Dani
#2

[eluser]TheFuzzy0ne[/eluser]
What's the URI you're using?

Also, please post your config.php file, minus any sensitive information.
#3

[eluser]jiffier[/eluser]
The problematic URL is

Code:
/customers/13?folder=2

The error it throws is <b>"The URI you submitted has disallowed characters."</b>


Here is the config.php:

Code:
$config['base_url']  = "http://www.domain.com/";
$config['index_page'] = "index.php";
$config['uri_protocol']    = "AUTO";
$config['url_suffix'] = "";
$config['language']    = "english";
$config['charset'f] = "utf-8";
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
$config['enable_query_strings'] = TRUE;
$config['directory_trigger'] = 'd';
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['log_threshold'] = 4;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['cache_path'] = '';
$config['encryption_key'] = "";
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']         = 300;
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";
$config['global_xss_filtering'] = FALSE;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;

Thanks in advance,

--
Dani
#4

[eluser]TheFuzzy0ne[/eluser]
The way you are using your URL would is as if you're trying to access a file named "13" in a directory named "customers" directly. It looks like your htaccess file is already trying to reroute that via index.php.

What your query string URI should look like, is something like this:

Code:
/?c=customers&m=13&folder=2
#5

[eluser]jiffier[/eluser]
Yes.. I have the .htaccess file that routes to CodeIgniter's index.php, but why then this URL does work correctly?

Code:
/customers/13

The CustomerController has a _remap method that will end up displaying data for customer id 13.
The strange thing is that this works on a local testing environment (Debian + apache).

Would this work if I could get PATH_INFO uri_protocol mode to work?

TIA,

--
Dani
#6

[eluser]TheFuzzy0ne[/eluser]
I can only assume that you've added a '?' to your allowed_uri_characters on your development environment.

Just out of interest, why exactly do you want to use query strings? I create a library which allows you to send arguments in a similar fashion over the URI, without having to use query strings. You might want to check it out: http://ellislab.com/forums/viewthread/106502/.
#7

[eluser]jiffier[/eluser]
No, I haven't added that on my Dev env... here it is:

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

If I add the "?" to permitted_uri_chars doesn't work either, but I think that the most reasonable will be stop using query strings, and one of the reasons is that I don't know yet where this application will end up being hosted.

I saw the uri_to_assoc() in http://ellislab.com/codeigniter/user-gui...s/uri.html, which looks very promising.. I don't know if it's available in 1.6.3 (the version I'm using), otherwise I could upgrade. I should upgrade anyway, the validators in 1.7 look promising too Smile


--
Dani
#8

[eluser]TheFuzzy0ne[/eluser]
I agree. If you haven't got too far into developing your application, it would be an ideal time to upgrade. I like to make sure I'm running the latest version at the start of each new project.




Theme © iAndrew 2016 - Forum software by © MyBB