Table of Contents

Page Redirector

page_redirector plugin by David Lorentsen
Redirect a wiki page to another wiki page

Last updated on 2007-01-24. Provides Syntax, Action.
No compatibility info given!

Tagged with redirect, relocate.

This plugin allows you to redirect users between pages and namespaces by adding a particular pattern to a page.

To cut down on the work needed when updating this plugin, I have decided to keep downloads, install, usage, history and so on, on my own site. Since that wiki isn't open to be edited without a user, I figured it would be best to leave discussion, ideas, bugs here. You are also welcome to email me. — David Lorentsen 2007-01-24 20:12

After the plugin is installed, a simple code redirects to another page:

~~REDIRECT>namespace:page~~

Bug fix

The wantedpages.php script breaks with this plugin:

ornellas@pound:~/ornellas.apanela.com/dokuwiki/bin$ php wantedpages.php

Fatal error: Call to undefined function  html_wikilink() in /home/.karamazov/ornellas/ornellas.apanela.com/dokuwiki/lib/plugins/pageredirect/syntax.php on line 50
ornellas@pound:~/ornellas.apanela.com/dokuwiki/bin$

To fix it, edit lib/plugins/pageredirect/syntax.php. After the first require_once add:

require_once(DOKU_INC.'inc/html.php');

This should solve the issue.

Discussion

I had a problem with this plugin. One of pages was using it to redirect user to other page (A → B), but later I deceided to “switch” pages and make the redirection work in the other direction: B → A. I removed redirection line from page A and added text onto this page; then removed text from site B and added a redirection line. All I get was a loop redirection (stopped after 5 redirections). Disabling and enabling or even reinstalling the plugin did not help…

Anyone solved this?

Solution: Open the redirect page you want to edit with the parameter ”?redirect=no” in the URL and you will get the page without getting redirected. — Markus Frosch 2008/08/06 10:17


Maybe an idea to lift this one from devel status so that it can be added to http://wikimatrix.org ? I just can't stand the idea that it is not available in Dokuwiki ;-)

If you redirect something it keeps redirecting even if you uninstall and reinstall a fresh plugin….does anyone know where the heck this data is stored so I can go in and change it.
Did you try ~~NOCACHE~~ on the redirected page?

For me the notice that I was redirected didn't display on the page. It's cause by the session not being started. The solution is to add session_start(); just underneath require_once(DOKU_PLUGIN.'action.php'); and comment out the other line that says session_start(); just above $_SESSION[DOKU_COOKIE]['redirect'] = $ID;Ryan McCue


There's a slight problem with the plugin: if the page has a period in it's name the plugin won't work. Could you make it accept periods in the title? -Claws


The code you append to the URL to stop the redirect is ”&redirect=no”. -tjones


Redirecting to pages with cyrillic names won't work! :( Can anyone help to solve this issue? -lolmaus


i've made patch that will allow anything in redirected page name, it works as the link is converted to wiki path internally

http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/dokuwiki-plugin-pageredirect-pagematch.patch

Elan Ruusamäe 2008/01/25 11:41


It says for build-2: “Optional text to tell the user he has been redirected.” Where is this described? I found no hints anywhere?! Bernd, April 16, 2008, 14:19


Is there a way to make the “Index” page exclude redirects? Thanks, – Matthew Pietz, 2008-07-22 14:17:23


Developer, do you plan on updating the plugin to merge the bug fix for the wantedpages.php script bug? The patch is in this page, only a merge is needed. Please update if you can. — Dace 2008/11/05 13:10


For me I changed the regex from ”~~REDIRECT>[a-zA-Z0-9_\-:]+~~” to ”~~REDIRECT>[a-zA-Z0-9_\-:\.]+~~”, because in my wiki I have pagenames including ”.”. Ist there a reason why hasn't been done in the original plugin? Dominik, 13.11.2008