wiki:ServerSideRedirectPlugin

Server Side Redirect from a Wiki Page

Description

This plugin allows you to place a redirect macro at the start of any wiki page which will cause a server side redirect when the wiki page is viewed.

This plugin is compatible (i.e. can be used) with the client side redirect macro TracRedirect, but doesn't depend on it. Because the redirect is caused by the server (using a HTTP redirect request to the browser) it is much faster and less noticeable for the user. The back-link feature of TracRedirect can also be used for server side redirected pages because both generate the same URL attributes.

A protection for first order redirect loop (A -> A) and second order redirect loops (A -> B -> A) is implemented, but higher order redirect loops (A -> B -> C -> A, etc.) must be handled by the browser or the user. Firefox 3 handles redirect loops well.

To edit a redirecting wiki page, access its URL with ?action=edit appended. To view the page either use ?action=view, which will print the redirect target (provided TracRedirect isn't active, which will redirect the wiki using client side code), or ?redirect=no, which disables redirection of both the ServerSideRedirectPlugin and TracRedirect plugin.

Direct after the redirect target is added (or modified) Trac will automatically reload it, as it does with all wiki pages. This plugin will detect this and not redirect but display the wiki page with the redirect target URL printed to provide feedback about the successful change. However, further visits will trigger the redirect.

To use the plugin place the macro at the begin of the wiki page:

[[redirect(OtherWikiPage)]]

or:

[[Redirect(OtherWikiPage)]]

The macro is normally not executed, but the plugin will scan every wiki page for it and execute the redirect before the wiki page is sent to the user. However, a fall-back implementation of the macro is provided, which displays the redirect target to the user. This message is also shown directly after the redirect macro was added to the wiki page to give the editing user some feedback over the successful change.

Please note that the lower-case version redirect is compatible with the TracRedirect macro, which is not redefined by this plugin if this macro is also enabled. The upper-case version Redirect is always provided by this plugin and will be ignored by TracRedirect.

In addition to a wiki page any other TracLink can also be used:

[[redirect(wiki:OtherWikiPage)]]
[[redirect(source:/trunk/file.py)]]
[[redirect(http://www.example.com/)]]

or

[[Redirect(wiki:OtherWikiPage)]]
[[Redirect(source:/trunk/file.py)]]
[[Redirect(http://www.example.com/)]]

Bugs/Feature Requests

Existing bugs and feature requests for ServerSideRedirectPlugin are here.

If you have any issues, create a new ticket.

defect

13 / 13

enhancement

1 / 1

task

1 / 1

Download

Download the zipped source from here.

The plugin is also available on PyPI.

Source

You can check out ServerSideRedirectPlugin from here using Subversion, or browse the source with Trac.

Installation

General instructions on installing Trac plugins can be found on the TracPlugins page.

Enable the plugin in your conf/trac.ini file as follows:

[components]
tracserversideredirect.* = enabled
tracextracturl.* = enabled

You may need to restart your Web server.

Recent Changes

17895 by rjollos on 2020-12-03 21:48:50
TracServerSideRedirectPlugin 1.0.2: Bump versions and release
17894 by rjollos on 2020-12-03 21:47:51
TracServerSideRedirectPlugin 1.0.1: Add release command
17891 by rjollos on 2020-12-03 21:43:41
TracServerSideRedirectPlugin 1.0.1: Remove www prefix from URL
(more)

Author/Contributors

Author: martin_s
Maintainer: Martin Scharrer
Contributors:

Last modified 3 years ago Last modified on Feb 26, 2022, 7:00:44 AM