Codeigniter 3.0 giving 404 not found

5

I've installed CodeIgniter 3.0 in my apache and when I have access link it returns me error 404 not found . The files of controller is correct and views too (only has HTML). What happens to give this problem in version 3.0?

login.php (controller)

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

class Login extends CI_Controller {

    public function index()
    {
        $this->load->view('login');
    }
}
    
asked by anonymous 26.05.2015 / 05:56

4 answers

0

Codeigniter 3 requires that the name of the controller files begin with a capital letter.

In your controllers folder, rename the file login.php to Login.php .

    
25.06.2015 / 19:30
1

Three cases:

  • Make sure that in your routes.php file you have set your primary route, if it is in the Login class

  • Make sure index.php is "messing up"

    • Access your url as follows: http://localhost/Azzunet/index.php/login

    • Or at the root of your project, include the code described in this link link and save it with the name .htaccess to remove index.php from your url (in addition you should also remove it from the config.php configuration as well)

  • Builder

    • Include the constructor of the class with the call parent::__construct();
  • 26.05.2015 / 17:17
    0

    I also had this problem and I was able to solve by putting the first letter of the file name, whether it be a controller, model and view in uppercase.

        
    02.06.2015 / 16:19
    0

    In my case, the problem started when I migrated the site to a new environment, and started giving 404 in all subpages. The problem was Apache configuration.

    I have edited httpd.conf, replacing all AllowOverride None instances with AllowOverride All (lines 231 and 268 in my case). I reinitialized Apache and everything worked fine.

        
    19.09.2017 / 17:15