CodeIgniter Forums
default controller eror?? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: default controller eror?? (/thread-52429.html)

default controller eror?? - El Forum - 06-10-2012


class Web extends CI_Controller{

public function __construct()
  // Your own construct code

// ini untuk setting halaman utama
function index(){

// ini untuk setting about us
function about(){
// ini untuk setting services
function services(){

// ini untuk setting Health safety & environmental
function health(){
// ini untuk setting project list
function project(){

// ini untuk setting client
function client(){

// ini untuk organization chart
function organization(){
// ini untuk setting contact us
function contact(){

<?php $this->load->view('header_view'); ?>

<div id="logo">
<img src="&lt;?php echo base_url(); ?&gt;images/logo.png" width="900" height="120" /></div>
     <div class="menuatas">
<div id="myslidemenu" class="jqueryslidemenu">
<li>&lt;?php echo anchor('','Home'); ?&gt;</li>
<li>&lt;?php echo anchor('about','About Us'); ?&gt;</li>
<li>&lt;?php echo anchor('services','Services'); ?&gt;</li>
<li>&lt;?php echo anchor('health','Health Safety & Environmental'); ?&gt;</li>
<li>&lt;?php echo anchor('project','Project List'); ?&gt;</li>
<li>&lt;?php echo anchor('client','Client'); ?&gt;</li>
<li>&lt;?php echo anchor('organization','Organization Chart'); ?&gt;</li>
<li>&lt;?php echo anchor('contact', 'Contact Us'); ?&gt;</li>
<br />

the problem is, if make default controller with my controller web, and when i click menu for about i have got eror

404 Page Not Found

what wrong with that? can anybody know this? please help me, i am nubie

for htacess
<IfModule mod_rewrite.c>
   RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

$config['base_url'] = 'http://localhost/mitra/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '.html';

route :

$route['default_controller'] = "web";
$route['404_override'] = '';

default controller eror?? - El Forum - 06-10-2012

Thats because you are missing the controller in your anchor tag
// anchor('controller/function')
&lt;?php echo anchor('web/contact', 'Contact Us'); ?&gt;

default controller eror?? - El Forum - 06-11-2012

Thank You

default controller eror?? - El Forum - 06-11-2012

You can also add a route

$route['contact'] = 'web/contact';