Welcome Guest, Not a member yet? Register   Sign In
Some confusion with the error functions
#1

[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?
#2

[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
#3

[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?




Theme © iAndrew 2016 - Forum software by © MyBB