1
votes

I'm using CodeIgniter. I set my default controller is 'cart'. And i add one more file in Controller folder that name is admin.php. admin.php having following code,

<?php

    class Admin extends CI_Controller {

        public function __construct()
        {
            parent::__construct();
        }

        public function index()
        {
            echo 'Hello World!';
        }

    }

?>

If i give the url like http://lo...host/codeigniter/admin means, It shows 404 Not Found. If i give http://lo...host/codeigniter/, It shows cart page as good.

And if i change default controller in routes.php as 'admin', http://lo...host/codeigniter/ shows 'Hello World!'

1

1 Answers

5
votes

Seem like your are not removing index.php from your URLs. Try to access to this URL:

http://lo...host/codeigniter/index.php/admin

If it works, then add this to your .htaccess file:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

More info: http://ellislab.com/codeigniter/user-guide/general/urls.html