CodeIgniter Forums
How to use this->index()? - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: How to use this->index()? (/showthread.php?tid=58460)

How to use this->index()? - El Forum - 06-13-2013

[eluser][email protected][/eluser]
I was watching a tutorial saying this function of
this->index() will redirect the controller load to the index page...

But my question, who's index page that is ?
The main site's? or the controller's?

Does it even work? I tried it on my test side, get 404.


How to use this->index()? - El Forum - 06-13-2013

class Blog extends CI_Controller {

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

public function rtm()

Quote:In the above example the function name is index(). The "index" function is always loaded by default if the second segment of the URI is empty.

$this->index() will run the index function and as a result echo Hello World!