Project

General

Profile

Actions

HowToRewriteForPMWiki » History » Revision 2

« Previous | Revision 2/13 (diff) | Next »
Anonymous, 2006-02-21 17:59
Updated code to work for one level inquiries


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.

{{{
$HTTP["host"] == "wiki.domain.tld" {
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.

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 Anonymous over 18 years ago · 2 revisions