Ariando
Ariando

Reputation: 1421

CodeIgniter error 404 page not found

I'm having trouble accessing pages or controller to be exact in codeigniter. The default controller working fine, but when I create a new controller it can not be accessed, when I exceute the url http://localhost/codeigniter/admin/login it shows error 404 Page Not Found. Here's my controller code, located in Codeigniter/applications/controllers/admin/Login.php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

class Login extends CI_Controller
{
    public function index()
    {
        $data = array(
            'title' => 'Login Administrator',
            'isi' => 'admin/login_view'
        );

        $this
            ->load
            ->view('admin/login_view', $data)
        ;
    }
}

and here's my config code :

$config['base_url'] = 'http://localhost/codeigniter/';
$config['index_page'] = 'index.php';

and here's my .htaccess file, located in the root folder (CodeIgniter)

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

I'm using local server XAMPP, I did enable the rewrite module, changed the httpd.conf AllowOverride None to AllowOverride All, but still won't working. I'm stuck at this point so please help :) Thankyou.

Upvotes: 1

Views: 3649

Answers (1)

Rajen Antarkar
Rajen Antarkar

Reputation: 162

Your .htaccess is not working. If you try to hit this url

http://localhost/codeigniter/index.php/admin/login

its working, for more details about how to remove "index.php" from codeigniter url you can refer this http://theprofessionguru.com/question/remove-indexphp-from-url-in-codeingiter

Upvotes: 1

Related Questions