[Pmwiki-users] Redirect on invalid page name?

Patrick R. Michaud pmichaud
Tue Aug 31 14:14:57 CDT 2004

On Tue, Aug 31, 2004 at 09:23:31PM +0200, Hochstrasser Benedikt wrote:
>    When  I  enter  a  page  url which is invalid (no CamelCase) I get the
>    "illegal page" error.
>    Is  it  possible  to  automatically run SearchWiki against the illegal
>    page name instead?

How about something like...

if (!preg_match("/^($GroupNamePattern)[\\/.]($PageTitlePattern)\$/",$pagename,

which automatically converts an invalid pagename into a search for
any page containing that string.  This is probably a useful Cookbook
recipe.  On the other hand, in PmWiki 2 there may no longer be anything
that results in an "invalid page name", since almost every page reference
gets treated like a free link.  :-)

>    In  any  case I suggest adding a link to "home" ($_SERVER["php_self"])
>    on the "illegal page" error page.

Excellent suggestion, although it should probably just link to 
$ScriptUrl since PHP_SELF is broken in many environments.  Added
as http://www.pmwiki.org/pmwiki2/pmwiki.php/PITS/00018.


More information about the pmwiki-users mailing list