CodeIgniter Forums

Full Version: Another 404 Not Found
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]gmonfort[/eluser]
Hello everybody, I'm new to CI, I like the framework and want to use it but I have some problems trying to set it up.

After a fresh installation, downloaded the CI files and put them in a folder in my webserver document root, try to access the default controller (welcome) and get a 404 Not Found page.

Problem description:
http://localhost/CodeIgniter/ --> welcome screen (welcome view)
http://localhost/CodeIgniter/index --> welcome screen
http://localhost/CodeIgniter/index.php --> welcome screen
http://localhost/CodeIgniter/welcome --> Not Found

Creating a new controller to test as suggested in the forums:
Code:
class Home extends Controller   {
        function Home(){
             parent::Controller();
        }

        function index(){    
             echo "test";
        }
}
http://localhost/CodeIgniter/home --> Not Found
http://localhost/CodeIgniter/index.php/home --> welcome screen
http://localhost/CodeIgniter/index.php?home --> get Test (works)
http://localhost/CodeIgniter/index.php?/home --> get Test (works)

All of this is with default installation config file:
Code:
// Config
$config['index_page'] = "index.php";
$config['uri_protocol']    = "AUTO";
// Routes
$route['default_controller'] = "welcome";

After changing 'uri_protocol' or 'index_page' same results but these changes:
With $config['index_page'] = "index.php?";
http://localhost/CodeIgniter/index.php/home --> now I get test (works)

Changing $config['uri_protocol'] = "AUTO"; doesn't seem to change anything.

These are my system details:
Linux debian 2.6.24-1-amd64
PHP Version 5.2.5-3
Apache/2.2.8
CodeIgniter 1.6.1

Any help would be very much appreciated.

El Forum

[eluser]Hermawan Haryanto[/eluser]
Why don't you take a quick look at the file /config/routes.php ?

Cheers,
Hermawan Haryanto

El Forum

[eluser]gmonfort[/eluser]
[quote author="Hermawan Haryanto" date="1209855464"]Why don't you take a quick look at the file /config/routes.php ?

Cheers,
Hermawan Haryanto[/quote]

Well if I change the default controller to my 'home' controller, then

http://localhost/CodeIgniter/ --> renders 'test' (works as expected)
http://localhost/CodeIgniter/home --> Not Found
http://localhost/CodeIgniter/welcome --> Not Found

Seems like there's a problem whith the 'controller-from-url' mapping.

El Forum

[eluser]m4rw3r[/eluser]
Do you have a .htaccess?

El Forum

[eluser]gmonfort[/eluser]
No I don't have any .htaccess yet

El Forum

[eluser]m4rw3r[/eluser]
Then your controller name should be appended after index.php:
http://localhost/CodeIgniter/index.php/controller
http://localhost/CodeIgniter/index.php/home

On how to add a rewrite to htaccess: search the forum, check the wiki and manual.

El Forum

[eluser]gmonfort[/eluser]
Thanks for your reply m4rw3r and Hermawan Haryanto.

Actually if I use index.php/controller and set $config['index_page'] = "index.php?"; it works as it should

http://localhost/CodeIgniter/index.php/welcome

but isn't there a way to omit the index.php?

El Forum

[eluser]m4rw3r[/eluser]
use the htaccess: wiki (solution 2 is a good one)

El Forum

[eluser]gmonfort[/eluser]
Ok I will look into that, thanks a lot for your help.

El Forum

[eluser]gmonfort[/eluser]
Excellent everything is working now with mod_rewrite, thanks again