Redirect Plugin
Create a redirect to another topic or website.
I typically use this to make easy-to-type shortforms/acronyms of topic names. For example:
- Actual content appears under
Main.LightweightDirectoryAccessProtocol
-
Main.LDAP contains just a redirect tag. Referencing Main.LDAP anywhere or entering it in the Go box takes one directly to Main.LightweightDirectoryAccessProtocol
- Redirect to a topic within the web:
%REDIRECT{"SomeTopic"}%
- Redirect to a topic in another web:
%REDIRECT{"Someweb.SomeTopic"}%
- Redirect to any URL:
%REDIRECT{"http://domain.com/"}%
- Pass parameters:
- Url parameters are passed on:
http://domain.com/twiki/bin/view/Main/TopicThatContainsARedirect?q=LDAP"}%. The landing topic url will contain these parameters
- Parameters can also be passed to the variable:
%REDIRECT{"Someweb.SomeTopic?q=LDAP"}%
-
REDIRECT parameters override url parameters
To view the topic that contains a
REDIRECT, pass parameter
noredirect=on to the url. For example:
http://domain.com/twiki/bin/view/Main/WebHome?noredirect=on
A redirect now appends the
redirectedfrom parameter to the url which contains the Web.Topic that the user has been redirected from. This allows us to display Wikipedia like "Redirected from ..." text on the destination topic. You can use the
%URLPARAM{redirectedfrom}% variable to access the parameter and create the "Redirected from..." text.
Below is an example you can put in your template:
%IF{ "$'URLPARAM{redirectedfrom}'" then="<span class='twikiGrayText'>(Redirected from <a href='%SCRIPTURLPATH{view}%/%URLPARAM{redirectedfrom}%?noredirect=on'>%URLPARAM{redirectedfrom}%</a>)</span>"}%
Which will display the following on topics that have been redirected:
(Redirected from
Web.Topic)
- Set SHORTDESCRIPTION = Create a redirect to another topic or website
- Set DEBUG = 0
If installed:
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
- Download the ZIP file from the Plugin web (see below)
- Unzip
RedirectPlugin.zip in your twiki installation directory. Content:
|
|
| File: |
Description: |
data/TWiki/RedirectPlugin.txt |
Plugin topic |
data/TWiki/RedirectPlugin.txt,v |
Plugin topic repository |
lib/TWiki/Plugins/RedirectPlugin.pm |
Plugin Perl module |
|
|
|
- Test if the installation was successful (see above syntax notes)
Topic revision: r22 - 2009-04-10 - 21:18:11 -
PeterThoeny