CodeIgniter Forums
404 page not found using index as function name in controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: 404 page not found using index as function name in controller (/showthread.php?tid=67605)



404 page not found using index as function name in controller - magnus_carlsen - 03-15-2017

I am new to CI. I am wondering why when I use index as function name, it says page not found. But if change index function name to something else, it display the page. I am trying this on my localhost.

Example code

PHP Code:
class Form extends CI_Controller {


        public function index()
        {
                $this->load->helper(array('form''url'));

                $this->load->library('form_validation');

                if ($this->form_validation->run() == FALSE)
                {
                        $this->load->view('myform');
                }
                else
                {
                        $this->load->view('formsuccess');
                }
        }




RE: 404 page not found using index as function name in controller - Narf - 03-15-2017

There's no reason why this would happen. Whatever the problem is, it's not the function name.