Project

General

Profile

Actions

HowToRewriteForPMWiki » History » Revision 4

« Previous | Revision 4/13 (diff) | Next »
darix, 2006-04-06 15:33
added a note about setting index-files.names instead of renaming the file


PMWiki CleanURLs with Lighttpd

Rewriting for PMWiki isn't very difficult at all. First of all, I'm assuming you have a hostname setup specifically for your wiki. A vhost of wiki.domain.tld is what I'll use in this example.

Your pmwiki needs to be setup in the root of this host, with pmwiki.php renamed to index.php. This makes life much easier. Now, simply add this snippet to your lighttpd.conf, after enabling mod_rewrite.

As alternative for renaming the "pmwiki.php", you can set 'index-file.names = ("pmwiki.php")'. This should give you the same effect as renaming the file.

{{{
$HTTP["host"] == "wiki.domain.tld" {
index-file.names = ("pmwiki.php")
url.rewrite-once = ( "^/([a-zA-Z0-9]+)/([a-zA-Z=?0-9.&:]+)$" => "/index.php?n=$1.$2","^/([a-zA-Z0-9/]+)$" => "/index.php?n=Category.$1" )
}
}}}

I have this code setup to redirect any one-level inquiries (http://wiki.domain.tld/group) to Category.$1. You can change that easily, and make it $1.$1 or Main.$1, whatever you want. (''blaster8'': I have found that to make all of the links with the 'lean' skin sane, the option $1.!HomePage is the best replacement for Category.$1)

Now, change your config variables in config.php to the following:

{{{
$EnablePathInfo = 1;
$ScriptUrl = "http://wiki.domain.tld";
}}}

Congratulations, it's setup and working.

Updated by darix over 18 years ago · 4 revisions