Part of the EllisLab Network
   
3 of 3
3
CI Stupidly Kills GET Data
Posted: 23 February 2008 05:24 PM   [ Ignore ]   [ # 31 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  156
Joined  05-19-2006

For edoornav,


at the configuration suggested by ZareMedia

application/config/config.php

$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
$config['permitted_uri_chars'] = '';

I’ve added

.htaccess

RewriteEngine On


RewriteCond
$1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?$1 [QSA,L]

this seems to enable mixed uri/qs urls without ‘index.php’ like

mysite.com/conroller/function/param?a=xx&b=yy

 Signature 

rapyd framework / demo

Profile
 
 
Posted: 24 February 2008 04:43 AM   [ Ignore ]   [ # 32 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  156
Joined  05-19-2006

Sorry..
after some more tests I think that the better (more compatible) solution
to use url like:  mysite.com/conroller/function/param?a=xx&b=yy

is:

$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";
$config['permitted_uri_chars'] = '';
$config['enable_query_strings'] = TRUE;


RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond
%{REQUEST_FILENAME} !-d
RewriteRule
^(.*)$ index.php/$1 [QSA,L]

 Signature 

rapyd framework / demo

Profile
 
 
Posted: 27 February 2008 09:34 AM   [ Ignore ]   [ # 33 ]  
Summer Student
Total Posts:  18
Joined  10-07-2007

i.e. the OpenID standard uses get requests.

Profile
 
 
Posted: 28 June 2008 04:20 PM   [ Ignore ]   [ # 34 ]  
Summer Student
Total Posts:  17
Joined  06-21-2007
Felice Ostuni - 24 February 2008 04:43 AM

Sorry..
after some more tests I think that the better (more compatible) solution
to use url like:  mysite.com/conroller/function/param?a=xx&b=yy

is:

$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";
$config['permitted_uri_chars'] = '';
$config['enable_query_strings'] = TRUE;


RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond
%{REQUEST_FILENAME} !-d
RewriteRule
^(.*)$ index.php/$1 [QSA,L]

Unfortunately this didn’t work for me,
I get a server error so it must be something with .htaccess

Profile
 
 
Posted: 29 June 2008 02:47 AM   [ Ignore ]   [ # 35 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  336
Joined  02-24-2008

Hmm… I’ve managed to get a system working whereby I can have URL’s like this:

http://site.com/controller/method/params/more/andmore/?andmore=blah

All I had to do was extend CI’s input class (MY_Input.php):

<?php
class MY_Input extends CI_Input {

    
function _sanitize_globals()
    
{
        $this
->allow_get_array = TRUE;
        
parent::_sanitize_globals();
    
}
    
}

And in my config.php

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

And it works fine!

 Signature 

http://www.jamierumbelow.net - My blog…
http://www.fourthtimelucky.com

Profile
 
 
Posted: 22 July 2008 08:25 AM   [ Ignore ]   [ # 36 ]  
Summer Student
Total Posts:  7
Joined  07-22-2008

Before I dig into the various number of solutions above I would just like to point out that it’s, or should be, considered a bug if a url fails because it has a parameter added to it. This isn’t normal web-behavior and can have unforseen effects, for example with Google Analytics and Google Adwords.

Example: http://www.example.com/blog/ is a blog that ends up being linked on some site. This sites forum-software adds a parameter to help you trace visits from them, making the url be:
http://www.example.com/blog/?referrel=somesite.com
suddenly your site returns 404 Page Not Found

It’s frankly very bad for sites…discarding it can be fine, but not error’ing out due to it.

Profile
 
 
   
3 of 3
3
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64453 Total Logged-in Users: 23
Total Topics: 80959 Total Anonymous Users: 0
Total Replies: 435682 Total Guests: 176
Total Posts: 516641    
Members ( View Memberlist )