You are here:
Foswiki
>
System Web
>
RedirectPlugin
Edit
Attach
Tags:
create new tag
,
view all tags
<!-- * Set SHORTDESCRIPTION = Create a redirect to another topic or website --> ---+!! Redirect Plugin %SHORTDESCRIPTION% I typically use this to make easy-to-type shortforms/acronyms of topic names. For example: * Actual content appears under =<nop>Main.LightweightDirectoryAccessProtocol= * =<nop>Main.LDAP= contains just a redirect tag. Referencing =<nop>Main.LDAP= anywhere or entering it in the _Jump_ box takes one directly to =<nop>Main.LightweightDirectoryAccessProtocol= %TOC% ---++ 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://wikipedia.org/"}%= * Pass parameters: * Url parameters are passed on: =http://%HTTP_HOST%/Main/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: <pre> http://%HTTP_HOST%/Main/WebHome?noredirect=on </pre> ---++ 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='foswikiGrayText'>(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="foswikiGrayText">(Redirected from <a href="?noredirect=on">Web.Topic</a>)</span> ---++ Don't check that the target topic exists If you pass the dontcheck=1 parameter then Foswiki will let you redirect to a topic that doesn't exist. This is very useful as a way to wrap up data form creators for applications. e.g. !RoleCreator: <verbatim> %REDIRECT{newtopic="%SCRIPTURLPATH{"edit"}%/%BASEWEB%/UnnamedRoleAUTOINC1?topicparent=RoleList;templatetopic=RoleTemplate;t=%SERVERTIME{"$day$hour$min$sec"}%" dontCheck="1"}% </verbatim> Now, for instance in WebLeftBar you can just use: <pre> * [[RoleCreator][Create Role]] </pre> ---++ Test topics If installed: * Sandbox.RedirectPluginTest - this topic should redirect to landing page: * Sandbox.RedirectPluginDestination ---++ Installation Instructions You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server. Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install". If you have any problems, or if the extension isn't available in =configure=, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help. ---++ Plugin Files | *File:* | *Description:* | | ==data/System/RedirectPlugin.txt== | Documentation Topic | | ==lib/Foswiki/Plugins/RedirectPlugin.pm== | Plugin Modulde | | ==data/Sandbox/RedirectPluginTest.txt== | Test Topic | | ==data/Sandbox/RedirectPluginDestination.txt== | Test Topic | ---++ Plugin Info | Plugin Author(s): | Foswiki:Main.AndrewJones | | Previous Authos(s): | TWiki:Main/SteveMokris | | License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] | | Plugin Release: | 1.1 | | Plugin Version: | 7923 (2010-06-26) | | Change History: | <!-- versions below in reverse order --> | | 25 Jun 2010: | (1.1) New release. Fixed Foswiki:Tasks/Item1527 - Foswiki:Main.ItaloValcy | | 07 Mar 2010: | Added facility to dontcheck destination topic exists - Foswiki:Main.MartinCleaver | | 09 Apr 2009: | Ported to Foswiki as 1.0; Update documentation - Foswiki:Main.AndrewJones | | 24 Nov 2008: | Ability to display Wikipedia like "Redirected from..." - Foswiki:Main.AndrewJones | | 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 | | Dependencies: | None | | Plugin Home: | http://foswiki.org/Extensions/%TOPIC% | | Support: | http://foswiki.org/Support/%TOPIC% |
Edit
|
Attach
|
P
rint version
|
H
istory
:
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Edit WikiText
|
More topic actions...
Topic revision: r1 - 14 Oct 2014,
UnknownUser
System
Log In
or
Register
Toolbox
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
User Reference
BeginnersStartHere
TextFormattingRules
Macros
FormattedSearch
QuerySearch
DocumentGraphics
SkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
AdminToolsCategory
InterWikis
ManagingWebs
SiteTools
DefaultPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Webs
Applications
ClassificationApp
Extensions
Main
System
Copyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki?
Send feedback