[pmwiki-users] Completely clean URLs (Was: Get rid of groups altogether?)

Joachim Durchholz jo at durchholz.org
Thu Oct 27 03:28:39 CDT 2005


Patrick R. Michaud schrieb:
> On Wed, Oct 26, 2005 at 04:02:04PM -0400, Waylan Limberg wrote:
> 
>>Yeah, that does clear up what you are asking and to my knowledge the
>>answer is currently  no. Here's why: There seems to be no easy way to
>>alter the format PmWiki uses when it generates links to PmWiki pages.
> 
> Sorry, I've been away on other projects and haven't had a chance
> to respond to this thread.  But I did want to quickly point out that
> it should be possible to get PmWiki to generate links w/o group names.
> One way may be to change the definition of $PageUrl:
> 
>     $FmtP['/\\$PageUrl/'] = '$ScriptUrl/$Name'
> 
> Another way might be to have the $ScriptUrl translation 
> automatically remove any group name that follows, leaving only 
> the page name:
> 
>     $FmtP['!\\$ScriptUrl/[^/]+/!'] = '$ScriptUrl/';

I think group name suppression should be limited to those links that are 
(a) within the Main group and (b) going to other pages in the Main group?
Otherwise, the docs in PmWiki/PmWiki<Lang> would become inaccessible, or 
would have to be moved into Main (the latter being not very desirable 
either).

Here's a first attempt (fully untested, I've got no idea how FmtP 
actually works):
   $FmtP['!\\$ScriptUrl/Main/!'] = '$ScriptUrl/';
or maybe
   $DefaultGroup = 'Main';
   $FmtP['!\\$ScriptUrl/$DefaultGroup/!'] = '$ScriptUrl/';

> Of course, this still means getting PmWiki (or the webserver)
> to do the right thing when *receiving* a url without a group,

That's easy enough[*] using mod_rewrite.

[*] Well, sort of. mod_rewrite often does unexpected things, because it 
interacts with parts of the Apache machinery that's usually not visible 
to administrators.
But I'm pretty sure something can be cooked up for that :-)

Regards,
Jo




More information about the pmwiki-users mailing list