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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With