All redirects should now be catered for by the 404 page. I exported list of permalinks, removed /wp/ and re-imported to catch those instances where a link was hard coded before moving WordPress to a subfolder.
My permalink structure changed at some point in the past from a date based format to just the post name. To get around this, I had previously added a check in the WordPress 404 template which I brought across to the new one:
$erroruri = $_SERVER['REQUEST_URI'];
if ( preg_match('/\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/(.*)/i', $erroruri, $match) ) {
$newurl = BASE_URL . "/wp/" . $match[1];
header("Location: $newurl");
exit;
}
This finds URLs in the format yyyy/mm/dd and converts them so that they can be properly redirected to the archive.
I am officially WordPress free! There are now no WordPress files on the server, just the posts and comments tables in the database and the wp-content/uploads folder. Everything else has been deleted and I can't ever see myself going back.