CodeIgniter Forums
New User Routing Troubles - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: New User Routing Troubles (/showthread.php?tid=51583)



New User Routing Troubles - El Forum - 05-09-2012

[eluser]Unknown[/eluser]
I am just starting to use CI, and don't quite get how these work.

Code:
$route['default_controller'] = 'news/view';
$route['404_override'] = '';

I can have those in there, and then going to my index page will load news->view() just fine. But adding on any other ones gives me object not found when I navigate to them.

Code:
$route['default_controller'] = 'news/view';
$route['404_override'] = '';
$route['news'] = 'news/view';
$route['news/view'] = 'news/view';

Why doesn't navigating to news or news/view work if the route works?

e.g. http://localhost/folder/news doesn't work when http://localhost/folder does and they point to the same place. Didn't even begin to make it use another parameter.


New User Routing Troubles - El Forum - 05-09-2012

[eluser]Aken[/eluser]
Did you remove index.php from your URLs? If not, the link will be http://localhost/folder/index.php/news


New User Routing Troubles - El Forum - 05-09-2012

[eluser]Unknown[/eluser]
That reply was enough for me to search for 'removing index.php', and finding another post linking to http://codeigniter.com/wiki/mod_rewrite/

The user guide's first steps don't mention anything about needing index.php, and refer to every url without it, so that's a bit misleading. Thanks for your help!

(The .htaccess in there worked immediately.)