CodeIgniter Forums
CodeIgniter 404 Page Not Found, but why? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter 404 Page Not Found, but why? (/showthread.php?tid=34159)



CodeIgniter 404 Page Not Found, but why? - El Forum - 09-21-2010

[eluser]CasperF[/eluser]
Hi,

I posted a question on stackoverflow (http://stackoverflow.com/questions/3752609) and it doesn't seem to get any traction. I would like to ask the question here - maybe this is the better place. Wink

Thanks for any help. This one is really stumping me.
Casper


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

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

The /admin/.htaccess file looks like this:

Code:
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:

Code:
$system_folder = "../system";
$application_folder = "../application/admin"; (this line exists of course twice lines 43 & 101)

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

Code:
$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:

Code:
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.


CodeIgniter 404 Page Not Found, but why? - El Forum - 09-21-2010

[eluser]Mr. Pickle[/eluser]
Are you sure both environments have the same .htaccess and routes file?

BTW, why have
Code:
$route['admin'] = 'welcome';
if the default controller for the admin app already is welcome

Is your production server running PHP as CGI and your local MAMP PHP Apache? -> which caused me some differences in behaviour in the past.


CodeIgniter 404 Page Not Found, but why? - El Forum - 09-21-2010

[eluser]CasperF[/eluser]
They don't have the *same* files the files have the same content, yes.

You are right! The phpinfo says "Server API CGI/FastCGI"

I found http://ellislab.com/forums/viewthread/96347/
But I haven't quite gotten it to work. It keeps on only showing the default controller, for every URL.

I have the $route['admin'] = welcome because I found that if I call up /admin on my local MAMP it would not redirect me to the default controller.


CodeIgniter 404 Page Not Found, but why? - El Forum - 09-22-2010

[eluser]CasperF[/eluser]
OK, solved it.

did not use: http://ellislab.com/forums/viewthread/96347/

Instead: changed the following in config.php
$config['uri_protocol'] = "REQUEST_URI";