This is a modification of the 404 function found at NSLog. This is tweaked such that if a page is not found on your WordPress blog, the part of the URI beyond the domain name is stripped off and fed into the WordPress search function. If only one post if found, that post is directly loaded. Otherwise the whole list of posts is loaded and displayed. Installation is really simple. Just copy the code below and paste it into a file called 404.php. Then open up the .htaccess in the root of your blog and add the following on a new line: ErrorDocument 404 /404.php /*Code for 404.php*/ <? $search_term = substr($_SERVER[‘REQUEST_URI’],1); $search_term = urldecode(stripslashes($search_term)); $search_url = ‘http://weblogtoolscollection.com/index.php?s=’; $full_search_url = $search_url . $search_term; $full_search_url = preg_replace(‘/ /’, ‘%20′, $full_search_url); $full_page = implode(“”, file($full_search_url)); print_r($full_page); die(); ?> EDIT: Replace the ‘http://weblogtoolscollection.com/index.php?s=’ with your blog name to get the right search results. […]
[Continue Reading...]