Code Igniter Function Call 404 Code Igniter Function Call 404 codeigniter codeigniter

Code Igniter Function Call 404


if you add a ? after index.php does it work?

http://example.com/index.php?/blog/comments


I came across this old post without a good answer as to why it was happening. I too came across the same apparent error that you did and was struggling to fix it. I realized the problem came from the routing that was set in earlier CI examples. My page wasn't working at all unless I added the following line inside config/routes.php:

$['blog'] = 'blog';

That is because of this line that considers anything, other than what you had already set, as arguments for the root:

$route['(:any)'] = 'pages/view/$1';

If you remove the above line, it'll all work, except the root won't work anymore as it did in the previous tutorials. I had to also add the following line so that we can call functions inside the controller:

$route['blog/(:any)'] = 'blog/$1';

With both of these two added, you can call functions on the root and yet also have a working "blog" controller.


By default, your example should work. Examine your configurations and remove .htaccess as your example aren't using mod_rewrite.

Start from scratch also helps you learn ;)