EllisLab text mark
Advanced Search
     
Is there a way to accept single GET parameter?
Posted: 21 July 2008 04:59 PM
Avatar
Joined: 2008-02-13
250 posts

If there is only one GET parameter in URL its name will be considered as first URI segment. As I can see this is to make URL like http://example.com/?blog/post/test to work without mod_rewrite.

This is a god think but sometimes I need to accept first GET parameter. For example, some major link directories are adding ?from=dir to each link. So when going through http://example.com/?from=dir I’m getting 404 since I have nothing mapped to “from”. I can map controller to “from”. It will solve one issue but not all similar issues…

Is there a way to accept first parameter as it is?

 
Posted: 21 July 2008 07:24 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2008-02-13
250 posts

Exel from Russian community found this:

URI.php

// If the URL has a question mark then it's simplest to just
// build the URI string from the zero index of the $_GET array.
// This avoids having to deal with $_SERVER variables, which
// can be unreliable in some environments
if (is_array($_GET) AND count($_GET) == AND trim(key($_GET), '/') != '')
{
    $this
->uri_string key($_GET);            
    return;

It prevents using GET with only one argument set.

 
Posted: 26 July 2008 01:43 PM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2008-02-13
250 posts

Yes, there is… by changing $config[‘uri_protocol’] to ‘PATH_INFO’.