ChangePmWikiURL

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


Goal

Alternate ways to enable use of $EnablePathInfo to make URLs like "site.dom/Main/HomePage" on a webhotel which allows mod_rewrite, but does NOT allow use of Apache "Alias" or "Files" configuration.

Solution

Try PmWiki.ChangePmWikiURL tricks first - then try this. Add the following to .htaccess in your DocumentRoot (not the pmwiki-directory):

 
 RewriteEngine on
 RewriteBase /
 RewriteRule ^wiki/([A-Z].*) /path/to/pmwiki/pmwiki.php?pagename=$1 [L,qsappend]
 RewriteRule ^wiki /path/to/pmwiki/pmwiki.php [L,qsappend]
 

Notice the last Rule just the wiki with no reference to a pagename. action=crypt and action=upload refer to just the $ScriptUrl and I couldn't get them to work without that bit. This also allows you to hide pmwiki directory from your public_html, although you still need to expose $PubDirUrl. Once configured, test it with e.g. crypt. browse site.dom/wiki?action=crypt.

Solution without mod_rewrite

If you don't have mod_rewrite, but are allowed to change file informations, you might want to do this:

Change the name of pmwiki.php to for example "site" (without the quotes) and write the following lines into your .htaccess:

    DirectoryIndex site
    <Files site>
    ForceType application/x-httpd-php
    </Files> 

Now you have to change your local/local.php (or wherever your configuration is located) to point to your new base URL. It's something like [(approve links) edit diff] with URLs for pages like [(approve links) edit diff]


Solution using Aliases

This worked for me under OS X and supported file uploads/etc:

Add to /etc/httpd/users/wiki.conf (order is important -- uploaded graphics would not display for me if if the last line was first):

 Alias /wiki/uploads /Library/WebServer/Documents/wiki/uploads
 Alias /wiki/pub     /Library/WebServer/Documents/wiki/pub
 Alias /wiki         /Library/WebServer/Documents/wiki/pmwiki.php

(If not on OS X, you can add it to your httpd.conf/etc. file.)

Edit /Library/WebServer/Documents/wiki/local/config.php (or your equivalent config.php file) to have:

 $ScriptUrl = '/wiki';
 $PubDirUrl = '/wiki/pub';
 $UploadUrlFmt = '/wiki/uploads';
 $EnablePathInfo = 1;

Restart Apache:

/etc/httpd/users> /usr/bin/sudo apachectl restart


Discussion

  • (yet to follow)

See Also

  • PmWiki.ChangePmWikiURL - the official

History

  • (none yet)

Comments & Bugs

  • I bet someone has done this already and documented elsewhere, but I couldn't find it..

pmwiki-2.3.33 -- Last modified by {{HaganFox}}

from IP: 85.171.160.186 ip should be disabled by default for security reasons