It's better when it's simple

User Tools

Site Tools


autosearch Plugin

Compatible with DokuWiki

Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky

plugin Handle s non-existent pages by redirecting to index sub-page if available; otherwise showing sub-pages and/or displaying Search Results

Last updated on

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to 404manager, autostart

Tagged with namespace, redirect, search

If the site visitor requests a non-existent page, autosearch pluging will kick in to show the following:

  1. Redirect to the index sub-page if one exists. For example, if :folder:index page exists but :folder page does not exist, and a visitor requests the :folder page, he/she will be automatically redirected to :folder:index page. The names of index subpages can be specified in the configuration manager.
  2. If no index subpage is available, show the list of subpages (requires indexmenu plugin) and also the results of searching the requested page title. The search results is useful especially when you move your pages around and static links from outside world into your site become obsolete.

Information and download:


zip file is not ok at all:

  • Create folder autosearch, open zipfile with an unzipper, select the files in the folder and unzip only these to your created folder.
  • In Linux, first create the autosearch directory (“mkdir autosearch”) in the same directory of zip file, then unzip it with “unzip”. When it ask to overwrite the autosearch directory, say “n”. — Samuele Tognini 2008/08/27 17:46

Indexmenu compatibility

You need to apply this patch to get latest indexmenu releases work:

diff -urN /tmp/autosearch/action.php ./autosearch/action.php
--- /tmp/autosearch/action.php  2007-07-03 12:15:00.000000000 +0200
+++ ./autosearch/action.php     2008-08-27 18:40:35.000000000 +0200
@@ -41,7 +41,7 @@
-      if($this->getConf('pagelist') && is_dir(dirname(wikiFN("$ID:dummy"))) &&
$indexmenu =& plugin_load('syntax', 'indexmenu')){
+      if($this->getConf('pagelist') && is_dir(dirname(wikiFN("$ID:dummy"))) &&
$indexmenu =& plugin_load('syntax', 'indexmenu_indexmenu')){
         $handled = $indexmenu->handle("{{indexmenu>$ID#2|js#default}}",null,nul
         $dummy_renderer = (object) array('doc'=>'');
         $indexmenu->render('xhtml',$dummy_renderer, $handled);

Correct start pages

I made a few alterations to correctly handle start pages named as configured (start by default) instead of hard-coded index:

diff -ur autosearch.old/action.php autosearch/action.php
--- autosearch.old/action.php   2014-03-31 16:54:00.662421400 +0100
+++ autosearch/action.php       2014-03-31 16:53:11.133588500 +0100
@@ -23,6 +23,7 @@
   function handle_act(&$e, $param){
+    global $conf;
     global $ID;
     if($e->data != 'show' || strpos($ID,'talk:')===0) return;
@@ -36,6 +37,9 @@
       foreach($index_pages as $index){
         if($index == '@subpage_with_same_name')
           $index = noNS($ID);
+        if($index == '@start_page')
+          $index = $conf['start'];
             header("Location: ".wl("$ID:$index", $perm < AUTH_CREATE ? "" : "auto_search_indexed=1"));
diff -ur autosearch.old/conf/default.php autosearch/conf/default.php
--- autosearch.old/conf/default.php     2009-05-20 17:50:38.000000000 +0100
+++ autosearch/conf/default.php 2014-03-30 23:40:27.858605200 +0100
@@ -1,4 +1,4 @@
-$conf['index_pages'] = 'index,home,@subpage_with_same_name';
+$conf['index_pages'] = '@start_page,@subpage_with_same_name';
 $conf['pagelist'] = 1;
 $conf['search'] = 1;
diff -ur autosearch.old/conf/metadata.php autosearch/conf/metadata.php
--- autosearch.old/conf/metadata.php    2009-05-20 17:50:38.000000000 +0100
+++ autosearch/conf/metadata.php        2014-03-30 23:40:27.862105700 +0100
@@ -1,5 +1,5 @@
 $meta['index_pages'] = array('multicheckbox',
-                          '_choices' => array('index','home','@subpage_with_same_name'));
+                          '_choices' => array('@start_page','@subpage_with_same_name'));
 $meta['pagelist'] = array('onoff');
 $meta['search'] = array('onoff');

Fernando Ribeiro

plugin/autosearch.txt · Last modified: 2023-10-30 22:58 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki