Google sitemaps occasionally lists dead URL's ( or posts ) coming from my forum. but in order to Remove dead URLs, the links have to resolve to a true 404 error. otherwise a post that no longer exists will take the Google link removal to phpbb's default "The topic or post you requested does not exist" page and that is not considered a valid 404 page.
So In viewtopic.php
- Code: Select all
---- FIND ---- ( two instances around lines 52 and 160)
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
--- REPLACE WITH ---
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . 'http://yoursite.com/fake404.html', true);
exit;
--- FIND --- ( around line 192 )
$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
message_die(GENERAL_MESSAGE, $message);
--- REPLACE WITH ---
if ( !$is_auth['auth_view'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . 'http://yoursite.com/fake404.html', true);
exit;
}
else
{
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']));
}
Just make sure to point http://yoursite.com/fake404.html into a fake URL from your own domain name so that it comes up with a true 404 error. then you will be able to submit outdated posts to be removed from Google's Index.
Hope this helps anyone who might find this useful.
----
All credit goes to those who contributed toThis thread. and even though there are some differences from the code I provided, it was what best worked for me. feel free to experiment with this and if anyone finds a better solution, please share.

English |
French

