user2189564
user2189564

Reputation: 41

Why 404 Page Not Found error occurs except default controller

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";
    }
}

Upvotes: 0

Views: 810

Answers (1)

Shaiful Islam
Shaiful Islam

Reputation: 7134

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.

Upvotes: 1

Related Questions