Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter 404 Page Not Found, but why?

Tags:

I am using CodeIgniter for two applications (a public and an admin app). The important elements of the document structure are:

/admin
/admin/.htaccess
/admin/index.html
/application
/application/admin
/application/public
/system
.htaccess
index.php

The /admin/.htaccess file looks like this:

DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

The /admin/index.php has the following changes:

$system_folder = "../system";
$application_folder = "../application/admin"; (this line exists of course twice)

And the /application/admin/config/routes.php contains the following:

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

Welcome is my default controller.

When I call up the Domain/admin I get a 404 Page Not Found error. When I call up the Domain/admin/welcome everything works fine. In the debug logs I get the following error message:

DEBUG - 2010-09-20 16:27:34 --> Config Class Initialized
DEBUG - 2010-09-20 16:27:34 --> Hooks Class Initialized
DEBUG - 2010-09-20 16:27:34 --> URI Class Initialized
ERROR - 2010-09-20 16:27:34 --> 404 Page Not Found --> admin

Weirdly enough this setup works perfectly on my local MAMP installation (with the localdomain/admin/), but when I publish and test it on the "live" server, I just get 404 errors.

Any ideas? What am I doing wrong? Thanks C.

like image 637
Joseph Avatar asked Sep 20 '10 14:09

Joseph


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.

How do I fix Page Not Found 404?

Retry the web page by pressing F5, clicking/tapping the refresh/reload button, or trying the URL from the address bar again. The 404 Not Found error might appear for several reasons even though no real issue exists, so sometimes a simple refresh will often load the page you were looking for.

Why am I getting 404 file or directory not found?

The following are some common causes of this error message: The requested file has been renamed. The requested file has been moved to another location and/or deleted. The requested file is temporarily unavailable due to maintenance, upgrades, or other unknown causes.


1 Answers

The cause of the problem was that the server was running PHP using FastCGI.

After changing the config.php to

$config['uri_protocol'] = "REQUEST_URI";

everything worked.

like image 163
Joseph Avatar answered Sep 28 '22 06:09

Joseph