1.6 Default Route

#8
[eluser]cynge[/eluser]
I'm running across this issue and wanted to consolidate another post to this thread:
http://ellislab.com/forums/viewthread/70451/

If your application is in a subpath, like site/folder/subfolder/, the URI library's uri_string is being set to /folder/subfolder/index.php. Then the _explode_segments method will create segments[0]='folder', segments[1]='subfolder', etc.

In the Router library, because the uri_string isn't blank, default routing isn't set in _set_routing(). In the _validate_request method, the same segments are used... the file site/folder/subfolder/folder.php may not exist, then the directory site/folder/subfolder/folder may not exist, so the default behavior is show_404().

So, I'm thinking somewhere along the line that the $config['base_url'] and $config['index_page'] need to come into play with the uri_string? I have a simple 'fix' in _validate_request, adding on to the if(is_dir conditional.....
Code:
else
{
     // Does the default controller exist?
     if ( file_exists(APPPATH.'controllers/'.$this->default_controller.EXT))
     {
        $this->set_class($this->default_controller);
        $this->set_method('index');
        $this->directory = '';
        return array();
      }
}
OR you can reset the uri_string after running $this->uri->_fetch_uri_string(); in the _set_routing method...
Code:
$index_page = str_replace( '?', '', $this->config->config['index_page'] );
$this->uri->uri_string = str_replace( $this->config->config['base_url'].$index_page, '', $this->uri->uri_string );
I don't know which is better or if it is more appropriate to rewrite the uri_string in the URI library.


Messages In This Thread
1.6 Default Route - by El Forum - 02-11-2008, 09:06 PM
1.6 Default Route - by El Forum - 02-13-2008, 04:42 PM
1.6 Default Route - by El Forum - 02-18-2008, 12:17 AM
1.6 Default Route - by El Forum - 02-18-2008, 12:30 AM
1.6 Default Route - by El Forum - 02-18-2008, 12:54 AM
1.6 Default Route - by El Forum - 02-18-2008, 01:05 AM
1.6 Default Route - by El Forum - 02-18-2008, 08:14 AM
1.6 Default Route - by El Forum - 02-27-2008, 03:47 AM
1.6 Default Route - by El Forum - 02-29-2008, 08:31 AM
1.6 Default Route - by El Forum - 02-29-2008, 10:52 AM
1.6 Default Route - by El Forum - 02-29-2008, 11:15 AM
1.6 Default Route - by El Forum - 03-26-2008, 04:08 PM
1.6 Default Route - by El Forum - 03-26-2008, 08:01 PM
1.6 Default Route - by El Forum - 03-26-2008, 08:12 PM
1.6 Default Route - by El Forum - 03-27-2008, 06:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.