This is an old revision of the document!
Table of Contents
404manager plugin
Compatible with DokuWiki
2009-03-16 (maybe earlier), lemmings, anteater, rincewind, angua
handle the soft 404 (file not found) for user and writer of DokuWiki by redirecting according to a configuration.
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 autosearch, autostart, goto, pageredirect, redirect
Download and Installation
Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.
Note :
- I just release it and I test it on my website. So, you can have some minor bugs but as it doesn't modify any data, it's safe.
- Work with php4 and php5.
- This plugin is not dependent of the plugin pagemove but is a consequence of it as I use it very often. The most important problem is that thus external links become obsolete (search engine for instance). With this plugin, I offer a way to manage the soft 404 (DokuWiki return a standard web page with a “200 OK” response code).
What can this plugin do ?
For writer :
- Automatic redirection in edit mode
- Verification that the page name is unique
For reader :
- Redirection by configuration of a target page for a source page with the admin page
- Redirection by best namepage
- Redirection by best namespace
- Redirection to the internal search engine
To know more about this plugin, please refer to this page : 404 Manager Plugin
Error with admin errors
I accidentally tried to redirect to a page that did not exist in the admin page, but the php died with
an error:
Fatal error: Call to undefined method admin_plugin_404manager::lang() in /www/wiki/lib/plugins/404manager/admin.php on line 93
Similar errors for other things.
Investigating I found that there appears to be a little bug in the script:
/** * handle user request */ function handle() { if($_POST['Add']){ $this->Vc_SourcePage = $_POST['SourcePage']; $this->Vc_TargetPage = $_POST['TargetPage']; if ( $this->Vc_SourcePage == $this->Vc_TargetPage ) { msg($this->lang('SameSourceAndTargetAndPage').': '.$this->Vc_SourcePage.'',-1); return; } if ( !page_exists($this->Vc_TargetPage) ) { if ($this->IsValidURL($this->Vc_TargetPage)) { $this->Vc_TargetPageType = 'Url'; } else { msg($this->lang('NotInternalOrUrlPage').': '.$this->Vc_TargetPage.'',-1); return; } } else { $this->Vc_TargetPageType = 'Internal Page'; } if ( page_exists($this->Vc_SourcePage) ) { $title = false; if ($conf['useheading']) { $title = p_get_first_heading($this->Vc_SourcePage); } if(!$title) $title = $this->Vc_SourcePage; msg($this->lang('SourcePageExist').' : <a href="'.wl($this->Vc_SourcePage).'">'.hsc($title).'</a>',-1); return; } $this->SetRedirection($this->Vc_SourcePage,$this->Vc_TargetPage); msg($this->lang['Saved'],1); }
The following lines should have square brackets and not round brackets:
85: msg($this->lang('SameSourceAndTargetAndPage').': '.$this->Vc_SourcePage.'',-1); 93: msg($this->lang('NotInternalOrUrlPage').': '.$this->Vc_TargetPage.'',-1); 106: msg($this->lang('SourcePageExist').' : <a href="'.wl($this->Vc_SourcePage).'">'.hsc($title).'</a>',-1);
Diff:
85c85 < msg($this->lang('SameSourceAndTargetAndPage').': '.$this->Vc_SourcePage.'',-1); --- > msg($this->lang['SameSourceAndTargetAndPage'].': '.$this->Vc_SourcePage.'',-1); 93c93 < msg($this->lang('NotInternalOrUrlPage').': '.$this->Vc_TargetPage.'',-1); --- > msg($this->lang['NotInternalOrUrlPage'].': '.$this->Vc_TargetPage.'',-1); 106c106 < msg($this->lang('SourcePageExist').' : <a href="'.wl($this->Vc_SourcePage).'">'.hsc($title).'</a>',-1); --- > msg($this->lang['SourcePageExist'].' : <a href="'.wl($this->Vc_SourcePage).'">'.hsc($title).'</a>',-1);
Configuration Problem
I'm trying to set up the 404manager plugin and after installing it (along with the note and pagemove plugins) it doesn't appear on the admin page. Could this be a conflict with the redirect plugin?
I'm using the 05-05-2008 version of dokuwiki. Upgrading at the moment is hard as I've personalised a lot of dokuwiki's config files, but if that's likely to be the problem then I'll do it
Merçi
The name in the admin menu is returned by the function getMenuText of the admin.php file in the plugin.
If the function don't find a translation, you normally must see the name of the plugin.
Problem solved. I just pressed the update button on the plugin management page. Don't understand what happened but the problem's solved. Thanks
IsRedirectionPresent & GoToEditMode Problem
There were apparently problems with implementing 404, both with this plugin and the core config option, with some users reporting that IE didn't get the edit page or the new page create dialogs properly. In testing with up-to-date versions of DokuWiki and IE this no longer seems to be an issue.