Brandon Wilson
Brandon Wilson

Reputation: 4600

Codeigniter 404 page not found

I have been developing a Codeigniter website locally for with a WAMP server on Windows, everything working fine. I uploaded the files to a Ubuntu server to a virtual directory and configuration the URL and .htaccess. The rewrite rule works like it should but now I get 404 when I try to access the site or any other controller link. The logs state that it cannot find the controller, I checked the files to make sure they were uploaded correctly.

At this point and I at a loss, I have a hunch that it is a configuration issue with Apache but I have checked all the configs that I know. What would cause a 404 error?

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Upvotes: 0

Views: 748

Answers (2)

JobSam
JobSam

Reputation: 317

In CI 3.0, All Class names must have the first letter capitalized with the rest of the name lowercase. Example: Where Model_name is the name of your class, this is how the class should be;

class User_model extends CI_Model {

    public function __construct()
    {
            parent::__construct();
    }

}

Then, the model should be loaded like this in the controller;

$this->load->model('user_model');

Please refer to this link: http://www.codeigniter.com/userguide3/general/models.html

Upvotes: 0

Antonio Oliveira
Antonio Oliveira

Reputation: 113

You have activated the module rewrite? If not, turn it on and restart wamp.

Also try to put index.php before the controller, may resolve the problem.

Upvotes: 3

Related Questions