Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter: 404 Page Not Found on Live Server

I have been developing a small web application with CodeIgniter. After testing it out locally I went to put it on my web server to allow a couple other people test out some features. While navigating to the site I get: -

404 Page Not Found error page

When viewing it in my local machine everything loads up and runs perfectly.

This is what I uploaded to the public_html directory:

application directory system directory assets directory (my assets for the site) index.php 

All of those are in the public_html directory. Like I said, it does give me CodeIgniters 404 error page, so I do know it is at least seeing CodeIgniter. I also tried changing the $config['base_url'], in the config.php, to my URL. Same error when changing that or leaving it blank. I checked my routes, and all those seem correct. Everything also loads up just fine when navigating to it on my local machine.

I also am not using a .htaccess file at this time

Any suggestions on what I should try?
Thanks a lot!

like image 237
twigman08 Avatar asked Feb 25 '15 00:02

twigman08


People also ask

Why is Codeigniter 404 not found?

404 Not Found is the HTML error code that indicates a particular situation in which the connection between the server and the client is working correctly, but the server could not find the resource requested by the client. The underlying causes of the error are several, but the general process is similar in all cases.


Video Answer


2 Answers

Changing the first letter to uppercase on the file's name and class name works.

file: controllers/Login.php

class: class Login extends CI_Controller { ... }

The file name, as the class name, should starts with capital letter. This rule applys to models too.

https://www.codeigniter.com/user_guide/general/models.html

like image 38
PolloZen Avatar answered Sep 19 '22 15:09

PolloZen


You are using MVC with OOPS Concept. So there are some certain rules.

1) Your class name (ie: controller name) should be start with capital Letter.

e.g.: your controller name is 'icecream'. that should be 'Icecream'

In localhost it might not be compulsory, but in server it will check all these rules, else it can't detect the right class name.

like image 141
Binoj T E Avatar answered Sep 19 '22 15:09

Binoj T E