Welcome Guest, Not a member yet? Register   Sign In
Default controller is always loaded
#1

[eluser]obay[/eluser]
Hi,

I am trying to migrate my CI 1.7.2 application into 2.0.2. I have gotten to the point where my default controller and page are loaded correct. Yey!

However, the default controller is all that's ever loaded. Example:

myapp/ -> loads default controller (one)
myapp/one -> loads default controller (one)
myapp/two -> loads default controller (one)
myapp/three -> loads default controller (one)

My .htaccess is:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

My config.php is:
Code:
$config['base_url'] = 'http://localhost/myapp/';
$config['index_page']     = '';
$config['uri_protocol']   = 'QUERY_STRING';

By the way, I've tried all other possible values for
Code:
URI PROTOCOL
and they give me "The page you requested was not found."

Finally, my routes.php is:
Code:
$route['default_controller'] = "one";

I also tried changing default_controller to "two" and it correctly loads the "two" controller. But when the default_controller is "one" and I type in "myapp/two" or "myapp/three" in the address bar, it still loads "one".

What am I missing? Smile
#2

[eluser]toopay[/eluser]
Change this line
Code:
RewriteRule (.*) index.php/$1 [L]
to
Code:
RewriteRule ^(.*) index.php?/$1 [L]
#3

[eluser]obay[/eluser]
Wow that solved it! Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB