Welcome Guest, Not a member yet? Register   Sign In
Please consider querystring support in 2.x

[eluser]sqwk[/eluser]
Is there a way to create an if host else inside htacess?

EDIT: This seems to work:

Code:
# Remove index.php DEV BOX
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^domain\.dev$ [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]

    # Remove index.php LIVE
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} !^domain\.dev$ [NC]
    RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]

[eluser]bretticus[/eluser]
@jayrulez You said it well.

Yes, I do sympathize with the fact that enabling query strings together with a segment based URI approach (mod_rewrite) depends on conditions that are outside of the control of the application (because it's higher up in the Web server.) I really feel like the CI guys just made a snap decision that certainly "gets in the way." I think the dialog was something like, "Man, there are so many inherent problems with query strings in this approach, let's just disable GET or force them to use query strings only."

I say, put some core logic in there that utilizes one of the hacks. Set it to FALSE in config and let us deal with the servers.

Perhaps, there is a way (parsing and analyzing the $_SERVER global, for example) to make a catch-all method of grabbing GET data. I'm just surprised that with all the complaints (yes, I have done my share) they haven't tried a solution better than $config['enable_query_strings'] = TRUE;

[eluser]pbreit[/eluser]
I'll take it one step further and suggest that "querystring_support" needs to be set to TRUE by default. In fact there shouldn't even be a config, it should just work. No downside. When you program something like a search, it's done with querystrings. Period.

[eluser]jfedgar[/eluser]
Just wanted to voice my agreement with (most) people on this board that CI's support of mixed URLs is SERIOUSLY lacking. This is especially true for people who are stuck on servers that do not allow path_info... which seems to be a large number of the big hosts.

It is ESSENTIAL these days to be able to extract information from query strings generated by other people, if you use WEB API's. Anything that uses oAuth is going to require this. Many that don't use oAuth send info through the query string only.

I shouldn't have to sacrifice clean urls to be able to accept query string parameters, and I shouldnt spend an ENTIRE DAY (as I did today, before I found this thread) creating a work-around for something that would take 15 seconds in raw php. That does not a good framework make :-\

I love codeigniter, so far I think they are the best I have used. However, lets not ignore the faults. Lets push ellislabs to do something about this. I was just about ready to go back to Zend today...

[eluser]jfedgar[/eluser]
Also, thank you Wan so much for your contribution... and to those of you who actually tried to understand the problem, and didn't just write it off as a newbie not reading the manual properly.

[eluser]wiredesignz[/eluser]
Try this in your PHP CGI environment.

.htaccess
Code:
RewriteEngine On

# Choose
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# or
#RewriteCond $1 !^(index\.php|imgages|css|js|robots\.txt|favicon\.ico)

RewriteRule ^(.*)$ index.php [L]


URI protocol and enable query strings
Code:
$config['uri_protocol'] = "REQUEST_URI";

$config['enable_query_strings'] = TRUE;

MY_Config.php
Code:
class MY_Config extends CI_Config
{    
    function site_url($uri) {
        return str_replace('/?', '/', parent::site_url($uri));
    }
}

MY_URI.php
Code:
class MY_URI extends CI_URI
{
    function _parse_request_uri()
    {
        if ( ! isset($_SERVER['REQUEST_URI']) OR $_SERVER['REQUEST_URI'] == '')
        {
            return '';
        }

        $request_uri = preg_replace("|/(.*)|", "\\1", str_replace("\\", "/", $_SERVER['REQUEST_URI']));

        if ($request_uri == '' OR $request_uri == SELF)
        {
            return '';
        }

        $fc_path = FCPATH.SELF;
        
        /* remove the query string from the uri */
        if (($pos = strpos($request_uri, '?')) !== FALSE)
        {
            $request_uri = substr($request_uri, 0, $pos);
        }

        $parsed_uri = explode("/", $request_uri);

        $i = 0;
        foreach(explode("/", $fc_path) as $segment)
        {
            if (isset($parsed_uri[$i]) && $segment == $parsed_uri[$i])
            {
                $i++;
            }
        }

        $parsed_uri = implode("/", array_slice($parsed_uri, $i));

        if ($parsed_uri != '')
        {
            $parsed_uri = '/'.$parsed_uri;
        }

        return $parsed_uri;
    }
}

Allows http://rscars.co.nz/cars-for-sale?page=2 to function correctly

Code:
$page = $this->input->get('page');

[eluser]pbreit[/eluser]
Wow, wired, that's way different from some other solutions I have seen. Is that really what it takes? Doesn't really matter for me anymore. I've moved on to Kohana, Fuel and Django.

[eluser]Ramania[/eluser]
I don't want to debate the CI support for query string but i just want to add my two cents...

I'm using my own made search, since it offers me better control on how i display search results, i don't use GET! again check this example:

Code:
http://www.somegamessite.com/products/search/call_of_duty/20/used/10/price/asc

isn't it more readable and human friendly than

Code:
http://www.somegamessite.com/prodcuts/search?game=call_of_duty&price=20&condition=used&result_per_page=10&order_by=price&order=asc

jQuery Ajax option can be set to Get or Post, some money payment gateways at least (MoneyBookers) send a standard post to your return/gateway success URL ...

i truly understand that people have different tastes in things, but after all, a purple Mercedes doesn't suite Mike Tyson Tongue ..

[eluser]skunkbad[/eluser]
[quote author="Ramania" date="1289840225"]I don't want to debate the CI support for query string but i just want to add my two cents...

I'm using my own made search, since it offers me better control on how i display search results, i don't use GET! again check this example:

Code:
http://www.somegamessite.com/products/search/call_of_duty/20/used/10/price/asc

isn't it more readable and human friendly than

Code:
http://www.somegamessite.com/prodcuts/search?game=call_of_duty&price=20&condition=used&result_per_page=10&order_by=price&order=asc

jQuery Ajax option can be set to Get or Post, some money payment gateways at least (MoneyBookers) send a standard post to your return/gateway success URL ...

i truly understand that people have different tastes in things, but after all, a purple Mercedes doesn't suite Mike Tyson Tongue ..[/quote]

So, when you are on page 2 or 3 of your search results, and you travel back through history, do you not get a message from the browser that it needs to resend the post? Using $_GET, you wouldn't get that message. It is quite common for people to travel back though history, and very annoying to do it with $_POST.

[eluser]Ramania[/eluser]
who said i use post? Tongue

Code:
function Index($viewName='def',$table=null,$searchWhat=null,$searchTerm='',$orderBy=null,$order=null,$limit='20',$offset='0')




Theme © iAndrew 2016 - Forum software by © MyBB