Allows redirects to intermap and external locations & implements silent 301 redirects.
Questions answered by this recipe
- How can I redirect visitors to non-wiki pages in a relatively safe manner?
- How can I disable the "Redirected from..." message?
RedirectIntermap adds functionality to the default
:) directive by permitting you to use InterMap links in addition to normal PmWiki pages. Additionally it implements
$EnableRedirectQuiet as defined in PITS 00919 in combination with the behaviour of the CustomRedirects recipe.
To install this recipe:
- download redirect-intermap.phpΔ to your cookbook directory
- add the following line to your config file:
The following variables may be set in your config file to configure the way RedirectIntermap works. The values shown are the defaults.
- Whether to show the "Redirected from..." message for permanent redirects. Set to
TRUEto enable. If enabled, the markup
(:redirect New.Page status=301:)will perform a silent redirect to
New.Page, ie. the "Redirected from..." message won't be shown. Note that not defining
status=301will still result in showing the redirection message on the destination page.
- Whether to allow redirections to previously defined InterMap locations. By default, this won't allow redirections to places that aren't explicitly defined as intermap locations, e.g. redirects to
- Whether to allow redirects to any location. This is dangerous if your wiki has public edit access, so make sure you really want this before enabling.
To redirect e.g. to this page, use:
Setting status codes also works, for example:
(:redirect Cookbook:RedirectIntermap status=301:)
To define your intermap links, see the PmWiki documentation on InterMaps.
- 20190915 update for PHP 5.5/7.2, quotes are no longer required for the URL. Requires PmWiki 2.2.58 or newer. (Petko)
- 20080213 — first release
See discussion at RedirectIntermap-Talk