CodeIgniter Forums
index.php removed and had "Object not found!" - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: index.php removed and had "Object not found!" (/thread-47611.html)



index.php removed and had "Object not found!" - El Forum - 12-15-2011

[eluser]Unknown[/eluser]
i'm using the user guide.
i tried the blog.php and blogview.php
on controllers folder:
blog.php
Code:
<?php
class Blog extends CI_Controller {

function index()
{
  $data['todo_list'] = array('Clean House', 'Call Mom', 'Run Errands');

  $data['title'] = "My Real Title";
  $data['heading'] = "My Real Heading";

  $this->load->view('blogview', $data);
}

function about()
{
  $data['todo_list'] = array('Home', 'About Us', 'Contact Us');

  $data['title'] = "My About Title";
  $data['heading'] = "My About Heading";

  $this->load->view('aboutview', $data);
}
}
?>

on the views folder:
blogview.php
Code:
<html>
<head>
<title><?php echo $title;?></title>
</head>
<body>
<h1>&lt;?php echo $heading;?&gt;</h1>

<h3>My Todo List</h3>

<ul>
&lt;?php foreach ($todo_list as $item):?&gt;

<li>&lt;?php echo $item;?&gt;</li>

&lt;?php endforeach;?&gt;
</ul>

&lt;/body&gt;
&lt;/html&gt;

aboutview.php
Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;?php echo $title;?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<h1>&lt;?php echo $heading;?&gt;</h1>

<h3>My Todo List</h3>

<ul>
&lt;?php foreach ($todo_list as $item):?&gt;

<li>&lt;?php echo $item;?&gt;</li>

&lt;?php endforeach;?&gt;
</ul>

&lt;/body&gt;
&lt;/html&gt;

on the config folder: routes.php
i changed the $route['default_controller'] = 'welcome'; to $route['default_controller'] = 'blog';.

on the config folder: config.php
i changed the $config['index_page'] = 'index.php'; to $config['index_page'] = 'index.php?';.

when i load the website.. it shows the right content.
http://localhost/ci/
function index()
BUT when i try..
http://localhost/ci/blog/about
to show function about()
it shows Object not found! Error 404.
when i try.. http://localhost/ci/index.php/blog/about
it shows the right content of function about().
I need to get rid of that index.php
What am i missing?

Thanks Smile