Redirect Plugin
<--
Contributions to this plugin are appreciated. Please update the plugin page at
http://twiki.org/cgi-bin/view/Plugins/RedirectPlugin or provide feedback at
http://twiki.org/cgi-bin/view/Plugins/RedirectPluginDev.
If you are a TWiki contributor please update the plugin in the SVN repository.
-->
Create a redirect to another topic or website
You can use this plugin 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 Jump Box takes one directly to Main.LightweightDirectoryAccessProtocol
Syntax Rules
- 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
Prevent Redirecting
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
Wikipedia-like "Redirected from..."
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)
%REDIRECT{"SomeTopic"}% in an included topic
Redirection happens even if %REDIRECT{"SomeTopic"}% is in an included topic. The redirectedfrom URL parameter has the including topic rather than included topic.
For example, let's say we have the following topics.
Then, when IncludingTopic is viewed, redirection to the RedirectDestination occurs with the redirectedfrom=WEB.IncludingTopic URL parameter.
IncludedTopic:
%REDIRECT{"RedirectDestination"}%
IncludingTopic:
%INCLUDE{"IncludedTopic"}%
Related Topics
Plugin Settings
- Set SHORTDESCRIPTION = Create a redirect to another topic or website
- Set DEBUG = 0
Test Topics
If installed:
Installation Instructions
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 TWiki server.
- For an automated installation, run the configure script and follow "Find More Extensions" in the in the Extensions section.
- Or, follow these manual installation steps:
- Download the ZIP file from the Plugins home (see below).
- Unzip
RedirectPlugin.zip in your twiki installation directory. Content: File: | Description: | data/TWiki/RedirectPlugin.txt | Plugin topic | data/TWiki/VarREDIRECT.txt | REDIRECT variable documentation topic | data/Sandbox/RedirectPluginTest.txt | Test topic | data/Sandbox/RedirectPluginDestination.txt | Test topic, landing page | lib/TWiki/Plugins/RedirectPlugin.pm | Plugin Perl module |
- Set the ownership of the extracted directories and files to the webserver user.
- Plugin configuration and testing:
- Run the configure script, and enable the plugin in the Plugins section.
- Test if the installation was successful: See Test Topics section above.
Plugin Info
Related Topics: VarREDIRECT, RedirectPluginDestination, RedirectPluginTest, TWikiPlugins, AdminDocumentationCategory |