404 Page Not Found The page you requested was not found: CodeIgniter Project

I have a codeigniter which works very fine on a local machine. After uploading this project to a hosted server, i start getting this error:
“404 Page Not Found
The page you requested was not found.”
I have tried several method to resolve it but still getting the same error message. bellow are my files.

Below is my config.php file showing the base url of my application:

$config['base_url'] = 'http://www.nicebis.com/';

This section contains the .htaccess File:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Options -Indexes

This section shows my database.php file

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'username';
$db['default']['password'] = 'password';
$db['default']['database'] = 'databasename';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

My rout.php file is below:

$route['default_controller'] = "account/login";
$route['404_override'] = '';

Please what is it that i’m not doing right? I need your help Thanks Ebere

I had exactly the same problem a week or so ago - turns out it was my .htaccess file: see https://www.sitepoint.com/community/t/codeigniter-3-and-cgi-fastcgi-solved/223069.

If @WebMachine’s post did not work, try.

  1. Without .htaccess file
  2. Check the logs
  3. Set php error_reporting(-1); and ini_set(‘display errors’, true);
  4. Set ./configure/configure.php threshold to 4
  5. Check log
  6. Create temporary index.html and make sure that works

@John_Betong , this application was hosted with a hosting company and i dont have access to Set ./configure/configure.php

CodeIgniter has a configure.php file in their configure directory that you have already modified to set the base_url();

Edit:
Add echo __FILE__; die; to the second line of index.php to make sure it is being called.

@John_Betong Yes, i ealier shared this, but once again, here is it :

$config['base_url'] = 'http://www.nicebis.com/';

$config['index_page'] = 'index.php'; 

Search in the configure.php file for threshold, read the comments and set the parameter to 4.

I do not have access to a desktop and typing on a tablet.

@John_Betong , i dont know if you woudnt mind, i can give you access to my system so that you help me figure it out. We can do that via team viewer or any other online means. Will you be chanced to help me out by tomorow, if possible, please tell me the time that will be convinience for you and the online means we will use.

@John_Betong i have been on this for a long time now still not getting any result

Yes I will help and will send a Personal Message tomorrow to make arrangements. Here it is very late so the message will be in about ten hours from now.

Did you rename the .htaccess file? Index.php should work and also other calls to controllers.

Did you find the threshold parameter and check the logs?

Yes i found threshold parameter and check the logs and i did not rename .htaccess. I await your message for your convinient time tomorow.

1 Like

At the very top of the index.php file add these lines.

echo 'Hello';
exit;

What do you see when that is done?

Hi @globalice,

It looks like CodeIgniter has been installed OK and is working but is configured incorrectly.

What CodeIgniter version have you installed?

Is you “local machine” running Windows?

Have you copied the ./controller/Welcome.php and the ,/views/welcome_message.php?

Please change your default route back to the original setting:

file: ./config/routes.php

   $route['default_controller'] = 'welcome';

This should render the welcome_message.php view contents and make it easier to debug.

@John_Betong Codeigniter was installed and the application in question runs correctly on my local machine. I only experienced this issues as i uploaded it on a hosted server.

I run codeigniter Version 2.2.2.

Also i have changed the default controller back to $route[‘default_controller’] = ‘welcome’; and on the hosted server, when i load www.nicebis.com, i was able to get to the welcome page.But when i changed it back to the way it runs on my local system, it get this “404 Page Not Found The page you requested was not found.” Error.
Please i still need your help. I’m available for online session as we discussed yesterday. Please when will it be convenient for you today i’m waiting?

Can you set the following route:

file: ./config/routes.php

$route['login'] = "account/login";

The login can then be tested by calling /login

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.