punbb/rewrite.php
changeset 9 a932ce8c4827
parent 6 5e1f1e916419
equal deleted inserted replaced
8:8baccbad4a55 9:a932ce8c4827
    87 }
    87 }
    88 
    88 
    89 // If we don't know what to rewrite to, we show a bad request messsage
    89 // If we don't know what to rewrite to, we show a bad request messsage
    90 if (empty($rewritten_url))
    90 if (empty($rewritten_url))
    91 {
    91 {
    92 	header('HTTP/1.x 404 Not Found');
    92 	header('HTTP/1.1 404 Not Found');
    93 
    93 
    94 	// Allow an extension to override the "Bad request" message with a custom 404 page
    94 	// Allow an extension to override the "Bad request" message with a custom 404 page
    95 	($hook = get_hook('re_page_not_found')) ? eval($hook) : null;
    95 	($hook = get_hook('re_page_not_found')) ? eval($hook) : null;
    96 
    96 
    97 	exit('Bad request');
    97 	die_friendly('Page not found', '<p>You have requested a forum URL that is invalid. Please press your browser\'s Back button to return to the page from whence you came, or return to the <a href="' . makeUrlNS('Special', 'Forum') . '">forum index</a>.</p>');
    98 }
    98 }
    99 
    99 
   100 // We change $_SERVER['PHP_SELF'] so that it reflects the file we're actually loading
   100 // We change $_SERVER['PHP_SELF'] so that it reflects the file we're actually loading
   101 $_SERVER['PHP_SELF'] = str_replace('rewrite.php', $url_parts[0], $_SERVER['PHP_SELF']);
   101 $_SERVER['PHP_SELF'] = str_replace('rewrite.php', $url_parts[0], $_SERVER['PHP_SELF']);
   102 
   102