CodeIgniter Forums
404 error for controller - 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: 404 error for controller (/showthread.php?tid=42257)



404 error for controller - El Forum - 06-01-2011

[eluser]Wonder Woman[/eluser]
Hi,

I hope someone can help. I have a controller called news and I just want to display the index function page but it throws a 404 error...the edit one works perfectly. I have two other controllers and they both work with the same code...

So if I go to "..admin/news" it doesn't work but if I do "..admin/news/edit/1" it works??

Code:
class News extends CI_Controller {

   function __construct()
   {
      parent::__construct();
      $this->load->model('admin/news_model');
      $this->load->library('form_validation');
      $this->load->library('session');        
   }

   function index()
   {        
      $this->load->view('admin/manage');
   }

   function edit()
   {
      // other code is in here but this works fine
      $this->load->view('admin/edit');
   }    
}

If you could help me out that would be great, thanks.


404 error for controller - El Forum - 06-01-2011

[eluser]osci[/eluser]
Do you happen to have an admin controller?

is admin/news/index working?


404 error for controller - El Forum - 06-01-2011

[eluser]Wonder Woman[/eluser]
Ooh yes admin/news/index is working...how do I fix this? Thanks for a speedy response btw Smile


404 error for controller - El Forum - 06-01-2011

[eluser]Wonder Woman[/eluser]
I think I have found the problem! I looked in my routes.php file and found this line which I forgot to delete:

Code:
$route['admin/news'] = 'admin/news_manager/index';

And I do have an admin controller, thanks for bringing it to my attention, I wouldn't have checked my routes.php file otherwise Smile