Forums / Cotonti / Extensions / [Release] 404search

Redirect a 404 page to search plugin

GHengeveld
#26648 2010-10-15 17:19
This plugin is meant to 'catch' broken URLs still listed in Google. If a 404 message comes up, this plugin checks for a referrer, and if that contains a search query (q=...) it redirects to the search plugin.

Installation:
  • Upload files to /plugins
  • Install through admin panel
  • Optionally: edit search plugin (see below)

» Download here

The plugin passes the Google query to the search plugin, but since the current search plugin doesn't support queries though GET, it won't show them. If you want them to show, you have to edit your search plugin:

In plugins/search/search.php, at line 29 you have this:
$sq = sed_import('sq','P','TXT',$cfg['plugin']['search']['maxsigns']);

Below that line, add this:
$q = sed_import('q','G','TXT',$cfg['plugin']['search']['maxsigns']);
if(!$sq && $q) $sq = $q;

Around line 39, you have:
$a = sed_import('a','P','ALP');

Below that, add this line:
if($q) $a = 'search';

In the future I may rewrite the search plugin to use GET instead of POST.

Added 2 hours 34 minutes later:

You can test it by running a Google search for "hyves mashup", which should return a link to "Project 3: Hyves Mashup" (www.ghengeveld.nl/weblog/p/29) at . This URL is dead, but will bring up the search. (Don't know how long Google will keep returning this result.)
This post was edited by Koradhil (2010-10-15 20:11, 13 years ago)