Welcome Guest, Not a member yet? Register   Sign In
Another 404 Not Found
#1

[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.
#2

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

Cheers,
Hermawan Haryanto
#3

[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.
#4

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

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

[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.
#7

[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?
#8

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB