Summary: This recipe modifies the behavior of PmWiki's
Prerequisites: PmWiki v2.1.0, possibly earlier
Is it possible to modify the behavior of PmWiki's
Note: PmWiki core's redirect markup now accepts the
status=301 additional parameter.
redirect markup is actually quite interesting. Using the option
status= parameter, PmWiki can send browsers the appropriate HTTP status code:
- 301 = moved permanently
- 302 = found
- 303 = see other
- 307 = temporary redirect
Usually, authors will want to use either 301 or 307. For convenience, PmWiki appends
?from=Page.Name to the URL, which is used by the new page to display the redirect message. Sometimes though, this is not the desired behavior. For permanently moved pages (those using
status=301), the new page will always have the query string attached as part of its permanent name. Search engines crawling the site may add new pages with this query string.
This recipe prevents PmWiki from appending anything to the URL when a 301 status code is requested. As a side effect, this recipe groups relevant redirect code into a single file, making it easy to further customize the behavior of
First, download redirect.phpΔ to your
cookbook directory. Now add the following line to
To omit query strings on redirects, use:
(:redirect New.Page status=301:)
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.