Some PmWiki tricks
I’m a fan of PmWiki because it’s so easily installed and needs no database. It only requires PHP on the server. The wiki pages are kept as simple files, with makes it very easy to backup and restore. Skinning is also very easy: you provide a template.html file in which you use some special tags. These tags will be replaced with actual content when the page is requested.
Apart from the skinning, there are two customizations that I did to my PmWiki installation.
The first is using https for the password form. Although PmWiki supports https, it’s an all-or-nothing approach: it will use the same scheme (http or https) all through the site. This puts unnecessary load on my server so I wanted to fix this. There are some hints on how to achieve this on the SwitchToSSLMode page, but it seemed pretty complicated. In the end I tried one of the suggestions from the talk page, which basically uses https for the password form’s POST and http for everything else. For this I had to change one line in pmwiki/scripts/forms.php, line 244. On that line the HTML for the form is constructed. I’ve added {$SecureScriptUrl} to start of the action attribute’s value so I code override the host address for the form. In the config.php I then added a line to set the $SecureScriptUrl to “https://pizzapazzi.com”. I’ve also force the $ScriptUrl to http:// so that only the POST action uses https, everything else will refer back to http.
The other customization had to do with cleaning up the URLs shown in the browser. By default a PmWiki URL will look like http://example.com/pmwiki/pmwiki.php?n=Main.HomePage. A couple of different approaches are described on the CleanUrls page. I went with the alternative using Alias, since the Apache mod_alias module was already enabled by default. I created an alias /wiki to point to /var/www/pmwiki/pmwiki.php, all from within Webmin. To clean up the initial URL, I’ve added a file /var/www/index.php which does an server side include of pmwiki/pmwiki.php.
Now to fix that skin.