[Bb-trac] [bbPress] #1129: Improved 404 reporting
bbPress
bb-trac at lists.bbpress.org
Thu Jun 25 13:09:23 GMT 2009
#1129: Improved 404 reporting
------------------------+---------------------------------------------------
Reporter: SteveBooth | Owner:
Type: defect | Status: new
Priority: low | Milestone: 1.0
Component: Front-end | Version: 1.0-rc-3 (trunk)
Severity: minor | Keywords: 404 permalinks improvements
------------------------+---------------------------------------------------
In trying to debug the problem with my bbPress implementation on my SunOS
host, it became very important to know who generated the 404 errors I
encountered when browsing to my bbPress home directory. Specifically, I
needed to know who was reporting the 404 error (i.e. who was calling
'404.php' in the selected template), and what uri was considered bad. To
do this, I enhanced the 404.php module and added a single line to
bb_repermalink. The simple changes greatly assisted in determining the
problem.
I would submit them as an enhancement for future releases.
First, I created a GLOBALS variable as follows, in bb_repermalink:
{{{
if ( $check != $uri && $check !=
str_replace(urlencode($_original_id), $_original_id, $uri) ) {
if ( $issue_404 && rtrim( $check, " \t\n\r\0\x0B/" ) !==
rtrim( $uri, " \t\n\r\0\x0B/" ) ) {
status_header( 404 );
$GLOBALS['bad404url'] = 'From functions.bb-
core.bb_repermalink $uri: >' . $uri . '<';
bb_load_template( '404.php' );
} else {
wp_redirect( $permalink );
}
exit;
}
}}}
And the 404.php code was modified slightly (I'm using the default
'Kakumei' template:
{{{
<h2 id="http404"><?php _e('Page not found!'); ?></h2>
<p>
<?php _e('I\'m sorry, but there is nothing at the URL:'); ?><br/>
<b><?php
_e($GLOBALS['bad404url']);?>
<br/></b>
<!-- //_e('['); _e(strlen($GLOBALS['bad404url'])); _e(' bytes]');
?><br/></b> -->
</p>
}}}
The basic intent here is to not just tell the user that there is a '404
Error', but to give him (and us) at least some hint as to who threw the
error and why.
--
Ticket URL: <http://trac.bbpress.org/ticket/1129>
bbPress <http://bbpress.org/>
Innovative forum development
More information about the Bb-trac
mailing list