routes.php question

#1
[eluser]stevea[/eluser]
I'm new to CI and have just finished up the Static example in the User Manual Tutorial.

Entering

www.mysite.com/CI_Tutorial/ci/index.php/pags/view

brings down the default home.php page, as expected, and entering

www.mysite.com/CI_Tutorial/ci/index.php/pags/view/about

brings down the about page, as expected. (Note that I've changed the controller name from pages to pags.)

Then I set $route['default_controller'] = 'pags/view'; and that let me enter just

www.mysite.com/CI_Tutorial/ci/index.php

to bring down the default home page.

No surprises yet.

But now if set $route['default_controller'] = 'pags/view/$1';

and I enter
www.mysite.com/CI_Tutorial/ci/index.php/about

I get a 404.

This surprises me, because if I use the other route example the tutorial gives:

$route['(:any)'] = 'pags/view/$1';

that does let me enter

www.mysite.com/CI_Tutorial/ci/index.php/about

and brings down the about page.

Can someone explain what's going on here? Why doesn't

www.mysite.com/CI_Tutorial/ci/index.php/about

bring down the about page after I set $route['default_controller'] = 'pags/view/$1';

Thanks,
Steve

#2
[eluser]Aken[/eluser]
The default controller route is only for when the homepage is viewed, aka example.com or example.com/index.php.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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