Riya Theo Tagas
Riya Theo Tagas

Reputation: 1

Codeigniter 404 Page not founds

i'm new to codeigniter. I'm making crud from a tutorial, whenever I run it.

It links to..http://localhost/gis-crud/

and it show error 404

i think it's just a problem on the uri or pagination of the controllers. What would be the problem?

apps.php - controller

class Apps extends CI_Controller{

function __construct(){
    parent::__construct();
    $this->load->model('m_data_lokasi','lokasi');
}

function index(){
    $data['q']=$this->lokasi->semua()->result();
    $this->tampil->display('apps/index.php',$data);
}  

Tampil.php - libraries

function __construct(){
    $this->_CI=&get_instance();
}

function display($tampil,$data=null){
    $data['_content']=$this->_CI->load->view($tampil,$data,true);
    $data['_header']=$this->_CI->load->view('tampil/header',$data,true);
    $data['_footer']=$this->_CI->load->view('tampil/footer',$data,true);
    $this->_CI->load->view('/tampil.php',$data);
}  

Tampil.php - view

<html>
    <head>
    <meta charset="utf-8">
        <title>CRUD-GIS</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes"/>

        <link href="<?php echo base_url(); ?>/assets/jquery.mobile-1.4.4.min.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="<?php echo base_url(); ?>/assets/jquery.min.js"></script>
        <script type="text/javascript" src="<?php echo base_url(); ?>/assets/jquery.mobile-1.4.4.min.js"></script>
        <style>
            #map-page, #map-canvas { width: 100%; height: 100%; padding: 0; }
        </style>
        <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>

    </head>
    <body onLoad="Initialize()">

    <?php echo $_header;?>

       <div role="main" class="ui-content">
         <?php echo $_content;?>
       </div>
    <?php echo $_footer;?>
    </div>

    </body>
</html>

config.php

$config['base_url'] = 'http://localhost/gis-crud/';

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';

Upvotes: 0

Views: 72

Answers (1)

curiosity
curiosity

Reputation: 844

save this code as .htaccess file

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

In your config folder look for routes.php change the

default controller

$route['default_controller'] = 'welcome';

To your Controller named Apps

$route['default_controller'] = 'apps';

once you call your $config['base_url'] = 'http://localhost/gis-crud/'; it will execute the default_controller above.

Upvotes: 0

Related Questions