Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 404 Error - Controllers Not Found
#1

[eluser]Unknown[/eluser]
I'm trying to get a development server working and have a fresh install of Ubuntu 13.10 with apache2 and php5 installed on it. On a fresh codeigniter install, the latest available (2.2.0), I can navigate to the default controller index function by using the base url, as configured in the config.php.

i.e. http://example.com/ci/ -> brings you to the default controller, welcome.php and the index function.

However, when navigating to http://example.com/ci/welcome/index or http://example.com/ci/index/ I get a 404 error. It seems to be that apache is seeing these as directories instead of reading the codeigniter controllers.

Everything in Apache is set to the default settings as well as php.ini, I have no .htaccess enabled because the ones I have tried have been unsuccessful.

These are the modules enabled given by phpinfo():
Code:
core
mod_so
mod_watchdog
http_core
mod_log_config
mod_logio
mod_version
mod_unixd
mod_access_compat
mod_alias
mod_auth_basic
mod_authn_core
mod_authn_file
mod_authz_core
mod_authz_host
mod_authz_user
mod_autoindex
mod_deflate
mod_dir
mod_env
mod_filter
mod_mime
prefork
mod_negotiation
mod_php5
mod_setenvif
mod_status

Any ideas?
#2

[eluser]CroNiX[/eluser]
If you are not using htaccess to reroute the requests to index.php, you need to include index.php in the url, like www.yoursite.com/ci/index.php/controller. The only time you don't is when going to the homepage/default controller.

#3

[eluser]Unknown[/eluser]
Ah, I didn't know that! But yes you're right, navigating through like that works perfectly. I couldn't understand why it was working through the index.php like that.

Thanks CroNIX
#4

[eluser]CroNiX[/eluser]
Just a FYI, those modules you listed in your first post are apache modules, not php. If you want to remove "index.php" from the url via htaccess, you need to enable the mod_rewrite apache module. That's why you couldn't get htaccess/rewrite to work before.




Theme © iAndrew 2016 - Forum software by © MyBB