Tags:
create new tag
view all tags
---+!! 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. --> <sticky> <div class="twikiTocFloat"> %TOC{title="Page contents"}% </div> </sticky> %SHORTDESCRIPTION% You can use this plugin to make easy-to-type shortforms/acronyms of topic names. For example: * Actual content appears under =%USERSWEB%.LightweightDirectoryAccessProtocol= * =%USERSWEB%.LDAP= contains just a redirect tag. Referencing =%USERSWEB%.LDAP= anywhere or entering it in the Jump Box takes one directly to =%USERSWEB%.LightweightDirectoryAccessProtocol= ---++ Syntax Rules * Redirect to a topic within the web: =%<nop>REDIRECT{"SomeTopic"}%= * Redirect to a topic in another web: =%<nop>REDIRECT{"Someweb.SomeTopic"}%= * Redirect to any URL: =%<nop>REDIRECT{"http://domain.com/"}%= * Pass parameters: * Url parameters are passed on: =http://domain.com/twiki/bin/view/%USERSWEB%/TopicThatContainsARedirect?q=LDAP"}%=. The landing topic url will contain these parameters * Parameters can also be passed to the variable: =%<nop>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: <verbatim> http://domain.com/twiki/bin/view/Main/WebHome?noredirect=on </verbatim> ---++ 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 =%<nop>URLPARAM{redirectedfrom}%= variable to access the parameter and create the "Redirected from..." text. Below is an example you can put in your template: <verbatim> %IF{ "$'URLPARAM{redirectedfrom}'" then="<span class='twikiGrayText'>(Redirected from <a href='%SCRIPTURLPATH{view}%/%URLPARAM{redirectedfrom}%?noredirect=on'>%URLPARAM{redirectedfrom}%</a>)</span>"}% </verbatim> Which will display the following on topics that have been redirected: <span class="twikiGrayText">(Redirected from <a href="?noredirect=on">Web.Topic</a>)</span> ---++ %<nop>REDIRECT{"SomeTopic"}% in an included topic Redirection happens even if =%<nop>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: <verbatim> %REDIRECT{"RedirectDestination"}% </verbatim> !IncludingTopic: <verbatim> %INCLUDE{"IncludedTopic"}% </verbatim> ---++ Related Topics * http://twiki.org/cgi-bin/view/Codev/RedirectPage * http://twiki.org/cgi-bin/view/Codev/PageRedirectTag * http://twiki.org/cgi-bin/view/Codev/TopicAliases * http://twiki.org/cgi-bin/view/Codev/RedirectToRenamedPage ---++ Plugin Settings * Set SHORTDESCRIPTION = Create a redirect to another topic or website * Set DEBUG = 0 ---++ Test Topics If installed: * Sandbox.RedirectPluginTest - this topic should redirect to landing page: * Sandbox.RedirectPluginDestination ---++ 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 [[%SCRIPTURL{configure}%][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 ==%TOPIC%.zip== in your twiki installation directory. Content: | *File:* | *Description:* | | ==data/TWiki/%TOPIC%.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/%TOPIC%.pm== | Plugin Perl module | * Set the ownership of the extracted directories and files to the webserver user. * Plugin __configuration and testing__: * Run the [[%SCRIPTURL{configure}%][configure]] script, and enable the plugin in the __Plugins__ section. * Test if the installation was successful: See Test Topics section above. ---++ Plugin Info | Plugin Author: | TWiki:Main.SteveMokris | | Copyright: | © 2003 TWiki:Main.SteveMokris, %BR% © 2003-2015 TWiki:TWiki.TWikiContributor | | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | | Plugin Version: | 2015-12-02 | | Change History: | <!-- versions below in reverse order --> | | 2015-12-02: | TWikibug:Item7703: Fix URL issue with anchor & query mismatch -- thanks TWiki:Main.JoshuaTharp for patch | | 2014-05-31: | TWikibug:Item7503: barfing undef Fast CGI and %<nop>TOC% | | 2013-08-14: | TWikibug:Item7315: redirectedfrom URL parameter based on %<nop>BASEWEB% and %<nop>BASETOPIC% -- TWiki:Main.HideyoImazu | | 2012-12-01: | TWikibug:Item7020: Add category to variable REDIRECT -- TWiki:Main.PeterThoeny| | 2012-09-20: | TWikibug:Item6937: RedirectPlugin doesn't recognize Site.Site.Page format. | | 2011-07-15: | TWikibug:Item6725: Change global package variables from "use vars" to "our"; doc improvements | | 2011-05-10: | TWikibug:Item6701: Doc improvements, adding VarREDIRECT variable documentation -- TWiki:Main.PeterThoeny | | 2011-02-14: | TWikibug:Item6664: Remove any newline characters from redirect URL before redirecting -- TWiki:Main.DipuDeshmukh | | 2010-07-25: | TWikibug:Item6530: Doc fixes | | 24 Nov 2008: | TWiki:Main.AndrewRJones: Ability to display Wikipedia like "Redirected from..." | | 22 Apr 2007: | Arthur Clemens: url parameters are now passed on. Adapted from TWiki:Main.JohnRouillard. | | 21 Apr 2007: | Arthur Clemens: fixed redirect to non-wiki word topics; added =noredirect=on= parameter; added support for TWiki:Codev.ShorterURLs. | | 10 Aug 2006: | Ability to redirect to URL restored by TWiki:Main/ThomasWeigert. Also added support for URL parameters. Fixed a few bugs. | | 09 Jun 2006: | Dakar port by TWiki:Main/MeredithLesley | | 20 Jun 2003: | Initial version | | CPAN Dependencies: | none | | Other Dependencies: | none | | Perl Version: | 5.005 | | Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/RedirectPlugin | | Feedback: | http://TWiki.org/cgi-bin/view/Plugins/RedirectPluginDev | | Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/RedirectPluginAppraisal | __Related Topics:__ VarREDIRECT, Sandbox.RedirectPluginDestination, Sandbox.RedirectPluginTest, %SYSTEMWEB%.TWikiPlugins, %SYSTEMWEB%.AdminDocumentationCategory
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r2 - 2020-05-29
-
TWikiAdminUser
Home
Site map
Sandbox web
TWiki web
TWiki Web
User registration
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
InterWikis
ManagingUsers
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Account
Log In
Register User
E
dit
A
ttach
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback
Note:
Please contribute updates to this topic on TWiki.org at
TWiki:TWiki.RedirectPlugin
.