CodeIgniter Forums
1.6 Default Route - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: 1.6 Default Route (/thread-6013.html)

Pages: 1 2

1.6 Default Route - El Forum - 02-11-2008

Can some tell me what I'm missing?

I was moving an unfinished project from CI 1.54 to 1.6 and my default route quit working. After fighting with that for a few minutes, I downloaded and extracted a fresh copy of 1.6.

http://localhost/CodeIgniter_1.6.0/index.php/ == 404

http://localhost/CodeIgniter_1.6.0/index.php/welcome/ == Welcome to CodeIgniter

Obviously, since this is a fresh copy routes.php contains
$route['default_controller'] = "welcome";

So, what am I missing?

Thanks in advance.

1.6 Default Route - El Forum - 02-13-2008

I'm having the same problem. Any help out there?

1.6 Default Route - El Forum - 02-18-2008


I tried a completely fresh install and it's not happening. == 404 Page Not Found == No input file specified. == Welcome to CodeIgniter!

PHP Version 5.2.3

I can't figure this out for the life of me, and I'm not that bad at PHP, just really confused here.

Any help is much appreciated!

1.6 Default Route - El Forum - 02-18-2008

What is contained in your htaccess file?

1.6 Default Route - El Forum - 02-18-2008

I get the same result with or without a .htaccess file:

But here it is:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /foo/bar # Where codeigniter resides
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

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

1.6 Default Route - El Forum - 02-18-2008

have downloaded 1.6.1 already? i believe the bug is fixed there.

1.6 Default Route - El Forum - 02-18-2008

Hello there, i was having the same problem with the previous version just now i updated to version 1.6.1 and still it is showing no controller, any info on this is truly appreciated.
The app worked fine on 1.5.4

Thanks in advance

1.6 Default Route - El Forum - 02-27-2008

I'm running across this issue and wanted to consolidate another post to this thread:

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.....
     // Does the default controller exist?
     if ( file_exists(APPPATH.'controllers/'.$this->default_controller.EXT))
        $this->directory = '';
        return array();
OR you can reset the uri_string after running $this->uri->_fetch_uri_string(); in the _set_routing method...
$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.

1.6 Default Route - El Forum - 02-29-2008


I'm facing the same default controller issue...Could you please explain me your 'reset the uri_string after running $this->uri->_fetch_uri_string();'code? I don't understand your $this->config->config[]syntax...

I can't solve my issue after patching the router.php file with your 2 lines of code.


1.6 Default Route - El Forum - 02-29-2008

As a quick note, I am using a relative url in my $config['base_url']. Something like '/folder/subfolder/'. My $config['index_page'] is 'index.php?'.

So when going to, the URI library sees PATH_INFO like /folder/subfolder/index.php. The Router then uses the segments created from the uri_string (Router around Line 91). CI thinks you are trying to use 'folder' as a controller, 'subfolder' as a method, and passing 'index.php' as an argument (or it's looking in the directory 'folder' for the controller 'subfolder'). Can you see where things are going wrong?

The only way I can think of to fix it without modifying the core URI directly (because I don't know if what we are experiencing is a true bug or us not knowing some configuration) is to patch the uri_string in Router before segments get created. I gave 2 suggestions in my post.

For the 2nd one that you are asking about... after fetching the uri_string around Line 91 of Router, I am removing the '?' in my $config['index_page'] and then removing my base_url and index page from the uri_string... leaving me with everything after the uri, which should be nothing so the default controller is used. I did it this way so I didn't have to hardcode that info. It's such a simple fix that I swear either we are not configuring something right or else PATH_INFO is not being used right in the URI core.

The 1st option I gave just gives one last chance to use the default controller before show404().