|
Cookbook /
CaseCorrectionSummary: Makes PmWiki intelligently case-insensitive
Version: 2008-09-03
Prerequisites: PmWiki 2.2.0-beta series, untested on 2.1.27 and earlier, requires
$EnablePathInfo setStatus: beta
Maintainer: EemeliAro
Discussion: CaseCorrection-Talk
Questions answered by this recipe
DescriptionCaseCorrection handles mistakes of case in PmWiki addresses (eg. The recipe can also be used together with a generic 404 page to catch mistakes such as To install this recipe:
What it doesWhen PmWiki can't find a page, it uses the contents of the page Site.PageNotFound to produce a 404 Page Not Found message that by default has a link to create the missing page. This recipe adds a function call to the rendering of that page that looks through the wiki for a case-insensitive match to the sought page, eg. Since CaseCorrection is only triggered if the system would otherwise produce a 404 page, it in no way limits what names you can give your pages; you can still have eg. ErrorDocument integrationThe code is structured in such a way that you can make Site.PageNotFound your default 404 page, and the user can be redirected to the wiki page they're actually looking for. If using an Apache server, you should add the following to your configuration (adjusting for whatever URL path resolves to your 404 page): ErrorDocument 404 /Site/PageNotFound
Since PmWiki will think it's just getting a request for the page Site.PageNotFound instead of whatever the actual requested URL was, CaseCorrection resets the values of a few page variables (specifically, Site.PageNotFound exampleThis is what I'm using on my sites. The (:case-correction:)
The location "{$RequestedUrl}" doesn't exist on this server.
(:if auth edit :)%rel=nofollow% ([[{*$FullName}?action=edit | Create {*$FullName}]])
(:if equal {*$Name} {$DefaultName} :)
(:searchresults {*$Group}:)
(:else:)
(:searchresults {*$Name}:)
(:ifend:)
NotesThe use of If you're using a 404 page in a location different from the default You can also use CaseCorrection to find partial matches, eg. to redirect Release Notes
See AlsoContributorsCommentsSee discussion at CaseCorrection-Talk User notes +3: 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. |