|
Cookbook /
RedirectMapSummary: create short urls for redirects using mapping similar to intermap
Version: 2008-07-11
Prerequisites: PmWiki 2.1
Status: new
Maintainer: HansB
Categories: Administration Links
Download: redirectmap.phpΔ
Questions answered by this recipeHow can I create short urls similar to tiny.com urls, but under my control? DescriptionThis recipe lets you create short url aliases, both for wiki page and http: links. InstallationDownload redirectmap.phpΔ, copy to cookbook/ folder and include in config.php include_once("$FarmD/cookbook/redirectmap.php");
UsageCreate 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. NotesThe script is adapted from the intermap routine in pmwiki.php. Release Notes
See AlsoContributorsCommentsVery nice recipe. Thank you. -Ian MacGregor |