[pmwiki-users] Creating a new page with GET/POST variables (or a form)

Patrick R. Michaud pmichaud at pobox.com
Sun Nov 11 12:43:54 CST 2007


On Fri, Nov 09, 2007 at 09:12:47PM +0200, alglt at yahoo.com wrote:
> Hi list,
> 
> Why does this work:
>  http://pmwiki.org/?action=edit&pagename=Cookbook.Testme
>  http://pmwiki.org/?action=edit&pagename=Test+me     ^^
>                                             ^^^
> And this doesn't:
>  http://pmwiki.org/?action=edit&pagename=Cookbook.Test%20me
>  http://pmwiki.org/?action=edit&pagename=Cookbook.Test+me
> 
> (the "pagename" variable is parsed, but not "action")

By default, whenever PmWiki detects that a pagename has been
specified in its non-canonical form (e.g., as "Test me" instead
of "TestMe"), it issues a redirect to get the browser to reload
the page with the canonical form of the name.  The primary reason
for this is to prevent browsers and search engines from
bookmarking the wrong form of the name.

However, the redirect also means that any ?action= or other
parameters get lost in the process.  PmWiki doesn't really
non-standard pagenames to appear in urls with ?action= or
other parameters attached.

The redirect behavior can be suppressed by setting

  $EnableFixedUrlRedirect = 0;

This setting tells PmWiki to accept whatever pagename it receives
(as long as it resolves properly) and not try to correct the url
with a redirect.

For the application described here (creating a page from a form),
you might want to do this as

  $EnableFixedUrlRedirect = ($action != 'edit');

which leaves the redirect in place for all actions except edit.

Pm



More information about the pmwiki-users mailing list