RedirectMap
Questions answered by this recipe
How can I create short urls similar to tiny.com urls, but under my control?
I want short urls to email confidential links on my restricted wiki.
Description
This recipe lets you create short url aliases, both for wiki page and http: links.
Installation
Download redirectmap.phpΔ, copy to cookbook/ folder and include in config.php
include_once("$FarmD/cookbook/redirectmap.php");
Usage
Create a redirect map file local/redirectmap.txt or wiki page Site.RedirectMap and add entries similar to intermap like
abcd: SomeVeryLongGroupName.SomeEvenLongerComplicatedPageName efg: http://www.example.com/ratherlong/and/windy/path/to/some/webpage.htm
Then having your url shortcuts defined, you can use them in emails or other places as urls like
http://mysite.org/mywiki/pmwiki.php?goto=abcd
or on wiki pages like
[[{$FullName}?goto=abcd| abcd]]
The recipe script checks input for a 'goto' parameter, then checks the redirectmap files or page to see if there is a match, and if it finds a match, activates a redirect to the mapped url.
Note the script redirects, so the user will not see the shortcut url.
Notes
The script is adapted from the intermap routine in pmwiki.php.
Release Notes
See Also
Contributors
Comments
Very nice recipe. Thank you. -Ian MacGregor
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.