CodeIgniter Forums
Some confusion with the error functions - 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: Some confusion with the error functions (/thread-36377.html)



Some confusion with the error functions - El Forum - 11-30-2010

[eluser]nuwanda[/eluser]
The manual states:

Quote:show_404('page')

This function will display the 404 error message supplied to it using the following error template:

application/errors/error_404.php

The function expects the string passed to it to be the file path to the page that isn't found. Note that CodeIgniter automatically shows 404 messages if controllers are not found.

This implies that if a controller is not found then the error_404.php file is shown, by default.

That's not happening with me. I'm just getting the normal Apache server error.

This is what I have in my error_404.php:

Code:
show_404('/');

I'm expecting my home page (root) to show when a controller is not found.

How can I fix that?


Some confusion with the error functions - El Forum - 11-30-2010

[eluser]InsiteFX[/eluser]
.htaccess
Code:
<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

InsiteFX


Some confusion with the error functions - El Forum - 11-30-2010

[eluser]nuwanda[/eluser]
[quote author="InsiteFX" date="1291121250"].htaccess
Code:
<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

InsiteFX[/quote]

Sure, I get that as far as .htaccess goes, but I'm obviously missing something about CI and 404s.

That is, if I use .htaccess to route my errors, then what do I need CI's error functions for?