Part of the EllisLab Network
   
 
404 Page Not Found
Posted: 07 December 2006 03:41 PM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  970
Joined  04-13-2006

This code from CodeIgniter.php

if ( ! method_exists($CI, $method))
        
{   
            show_404
();
        
}


will obviously generate a “404 Page Not Found” error when the requested method is not found. In some cases you can fix this by making sure your classes have an index() method, even if it does nothing.
This is likely to be a common cause of the logging of “404 Page Not Found” errors with no page shown, which has irritated several posters here.
I haven’t posted this as a bug because it is probably what Rick intended. However it would surely be sensible to raise a different error for missing methods than for missing pages.

Profile
 
 
Posted: 12 December 2006 07:40 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  20
Joined  12-08-2006

If I have index method in my controller and index does nothing, by ex. in Users controller with address http://example.com/users/ I make redirect in index method to default action which is login() / profile() for “not logged in / logged in” users. Case you are describing occurs when visitor(human or robot or whatever it is) rewrites url manually and in that case this error message is IMHO OK.

 Signature 

I’m agile developer (not designer) from Slovakia smile Samples of my work you can find at http://www.ivansuchy.com

Profile
 
 
Posted: 13 December 2006 05:42 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
RankRankRank
Total Posts:  970
Joined  04-13-2006

Whatever the reason, a “404 Page Not Found” error - with no further information - is not an acceptable way to log an error. Fixing this has saved me a significant of debugging time.

Profile
 
 
Posted: 18 January 2007 10:24 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  06-12-2006

In CodeIgniter.php try changing

show_404();

to

show_404($method);

Also, In system/libraries/Router.php

line 217 and 240 (or so):

replace

show_404();

with:

$page= implode("/", $segments);
show_404($page);

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64453 Total Logged-in Users: 24
Total Topics: 80959 Total Anonymous Users: 1
Total Replies: 435688 Total Guests: 195
Total Posts: 516647    
Members ( View Memberlist )