[pmwiki-users] Get rid of "Main"? (CleanUrls)

Patrick R. Michaud pmichaud at pobox.com
Tue Sep 26 11:14:42 CDT 2006


On Tue, Sep 26, 2006 at 04:31:41PM +0200, Mike wrote:
> > I think it can be done, 
> 
> Good news...
> 
> > it just requires some tricky-ish configuration
> > of PmWiki (and possibly the webserver).
> 
> ...less good news, as I could become a typical example of PEBKAC, unless
> there's some idiot-proof instructions somewhere...

I *think* the following will work in config.php:

    ##  add default group (Main) to page search path
    $PagePathFmt = array(
      '{$Group}.$1',           # page in current group
      '{$DefaultGroup}.$1',    # page in default group (Main)
      '$1.$1',                 # group home page
      '$1.{$DefaultName}',     # group home page
    );

    $pagename = MakePageName('Main.HomePage', $pagename);

    ## reformat page urls to omit default group (Main)
    $EnablePathInfo = 1;
    $FmtPV['$PageUrl'] = 'PUE(($group==$GLOBALS["DefaultGroup"])
                            ? "$ScriptUrl/$name"
                              : "$ScriptUrl/$group/$name")';
    $FmtP["!\\\$ScriptUrl/$DefaultGroup/!"] = '$ScriptUrl/';


I have this running at http://www.pmichaud.com/sandbox/nomain/pmwiki.php .
But it wouldn't surprise me if I've overlooked something somewhere,
so it would need some testing.

Pm




More information about the pmwiki-users mailing list