create new tag
, view all tags

RedirectPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on RedirectPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below
• See RedirectPluginDevArchive for older discussions.

Feedback on RedirectPlugin

-- SteveMokris - 20 Jun 2003

The Redirect plugin is pretty sensible on WikiWord, I try REDIRECT{Blackmont} and it doesn't work buy REDIRECT{RedMont} work.

I think it's a bug ?

-- CyrilleMastchenko - 30 Mar 2007

I've updated the plugin: fixed redirect to non-wiki word topics; added noredirect=on parameter; added support for TWiki:Codev.ShorterURLs.

-- ArthurClemens - 20 Apr 2007

Arthur, do you know if the current release include my fix (from RedirectPluginDevArchive) for REDIRECT preserving a query string?

-- JohnRouillard - 21 Apr 2007

It didn't, but it does now. Thanks for the note. I've included your code with a minor modification.

I have also updated the plugin topic with the query string documentation.

-- ArthurClemens - 21 Apr 2007

There is a problem if a topic with a REDIRECT entry is put into the Jump box. The redirect hangs the browser and an eventual browser warning message is published. In firefox

The page isn't redirecting properly

Firefox has detected that the server is redirecting the 
request for this address in a way that will never complete.

-- PeterJones - 23 Jul 2007

Whilst the redirect works fine to Twiki topics, and to http:// url's; it does not appear to work when attempting to redirect to a file:// url's (although such a url can be set sucessfully as a link in a page which when clicked on does go to the specified file.

-- MichaelChambers - 24 Jul 2007

If I understand rfc 2396 correctly, the fragment (the anchor) goes at the tail end of the uri, not before the query string. When they're both present -- as can happen now that the query string is preserved, the browser will misinterpret the fragment. This is breaking a use of the plugin I have where the redirection target is passed in the query string.

-- RobertMiller - 03 Nov 2007

I would LOVE it if REDIRECT could take advantage of InterwikiPlugin!

I want to do %REDIRECT{"OtherWiki:Web.Topic"}%.

-- VickiBrown - 20 Dec 2007

As PeterJones mentioned, the Jump box is broken with redirects because it appends a "topic" parameter which will cause loopiness. One way to "fix" this is to have RedirectPlugin omit the 'topic' param if it exists. Add the line:

$param eq 'topic' and next;

right after the start of the loop:

foreach my $param ( $query->param ) {

At RedirectPlugin.pm line 83 in my Rev: 13491 (21 Apr 2007)

-- AdamMorton - 08 Feb 2008

Excellent plug-in! I used it today for auto-link to external web site using WikiWord. I just create TheTopic I want to autolink and put a single %REDIRECT% in it.

-- StephaneLenclud - 21 Apr 2008

I have sub webs (three deep at present) ... PSFM.IT.Issues.Webhome, is an example... REDIRECT plugin seems to only support single level webs (can't do %REDIRECT{"PSFM.IT.Webhome"}% for example).

if ( $dest =~ /^((.*?)\.)*(.*?)(\#.*|\?.*|$)$/ ) {
and a few lines after seem to be the appropriate line to fix, but I can't quite puzzle my way through it.

-- MatthewKoundakjian - 02 May 2008

Scratch that last one ... I can %REDIRECT{"PSFM/Sections/Structures.WebHome"}%

Just can't %REDIRECT{"PSFM.Sections.Structures.WebHome"}%

-- MatthewKoundakjian - 02 May 2008

To be consistent I think that should be fixed.

-- PeterThoeny - 03 May 2008

Suggestion for improvement: Add a

parameter, would be a useful feature!

-- SaschaVetter - 30 May 2008

What would also be useful is a 'redirected from ...' note that gets appended at the top of the site (like on wikipedia) without changing the topic itself.. we want to move a lot of topics and reorganize the webs so this would alert people to update their bookmarks...

-- MarcelPartap - 13 Jun 2008

and on Wikipedia I think a rename automatically creates a redirect, so that old favorites (or stored/distributed links) still work.

This should become a new (optional) feature!

-- MatthiasThullner - 28 Aug 2008

I've made a small patch that allows us to display Wikipedia like "Redirected from ..." text by adding a URL parameter. As this is marked ContactAuthorFirst I wont upload it now so the author can either take my patch and update it themselves or let me know and I will do it.

Here is the patch:

Index: RedirectPlugin.pm
--- RedirectPlugin.pm   (revision 17599)
+++ RedirectPlugin.pm   (working copy)
@@ -126,12 +126,16 @@
             $queryString = $1;

-        $queryString = "?" . $queryString if $queryString;
+       # AndrewRJones: allow us to use %<nop>URLPARAM{redirectfrom}% in
+       # destination topic to display Wikipedia like "Redirected
+       # from ..." text
+        my $q = "?redirectedfrom=$web.$topic";
+        $q .= "&" . $queryString if $queryString;

         # topic exists
         TWiki::Func::redirectCgiQuery( $query,
             TWiki::Func::getViewUrl( $newWeb, $newTopic ) . $anchor
-              . $queryString );
+              . $q );


If I don't hear anything in a couple of weeks i'll just go ahead and implement it.

-- AndrewRJones - 09 Oct 2008

Hi Andrew,

this is a first step, but only half way. MediaWiki offers a 'button' to go back to topic wherefrom redirected with '?redirect=no', to be able to edit the redirect command.

feature request is:

  • include something in skin like:
    %IF{"defined REDIRECTEDFROM" then="redirected from [[%REDIRECTEDFROM?noredirect=on][%REDIRECTEDFROM%]]" }%
  • pass the variable REDIRECTEDFROM to the rendered topic
  • this string should be concatinating to show multi redirects at one spot

-- MatthiasThullner - 09 Oct 2008

This is easy enough to do with this patch by doing the following:

[[%<nop>URLPARAM{redirectfrom}%?noredirect=on][Edit %<nop>URLPARAM{redirectfrom}%]]

Bassically it allows you to get the Web.Topic name in the destination topic. If you have that then you can use it like any other variable, including if statements. This is how we use it in our templates:

%IF{ "$'URLPARAM{redirectfrom}'" then="<div class='twikiGrayText'>(Redirected from <noautolink>%<nop>URLPARAM{redirectfrom}%</noautolink>)</div>" }%

It appears under the breadcrumb.

-- AndrewRJones - 10 Oct 2008

Thank you AndrewRJones & JoshuaTharp! I finally updated the RedirectPlugin with your fix as described here, in Support.SID-01846 and Support.SID-01848.

-- Peter Thoeny - 2015-12-03

Edit | Attach | Watch | Print version | History: r68 < r67 < r66 < r65 < r64 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r68 - 2015-12-03 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.