0
votes

I am using OS Ubuntu. I am creating the application on codeigniter and facing problem while I am running my code. Only default controller is working, other then that are not working and application through the error:

404 Page Not Found

The page you requested was not found.

Code: Controller Name: Test


defined('BASEPATH') OR exit('No direct script access allowed');

class Test extends CI_Controller {

    public function index()
    {
        echo "Hi this is Test Controller";
    }
}

1
Does it work when index.php is included in URL (i.e. http://servername/index.php/test)? - Tpojka
Would you add your routes file aswell and the config file where it says $config['uri_protocol'] - killstreet

1 Answers

1
votes

There may be many reason where CI can display 404 Page Not Found.

As example

  1. If the File does not exists in your controller folder.
  2. If you using CI-3 in that case File name and class name should be same and UCfirst.So your controller file name should be Test.php not test.php.
  3. If your url is not valid. like you using link without index.php but you did not do steps to work without it(.htaccess,..).

Note: Try to use your link http://your_site_base_url/index.php/test if it does not work means you have any of those problem.