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

Michael Widowitz michael at widowitz.com
Mon Oct 31 14:57:09 CST 2005


Thanks for all the replies and effort. It looks like the initial wish
should be possible to implement. Unfortunately, I am not technical
enough to be able to drill it further and finish up on what you suggested.

The way I see it, there are two challenges:
1) Make sure that PmWiki generates links in a way that, if a link goes
to the "main" group, the group name is supressed. I.e., links like these
would be generated:
wikisite.com/FirstPage ("Main" suppressed)
wikisite.com/SecondPage ("Main" suppressed)
wikisite.com/Site/SideBar ("Site" stays)
wikisite.com/PmWiki/About ("PmWiki" stays)
etc.
For this purpose, I tried to insert the modification suggested by you,
Joachim, into pmwiki.php. However I don't seem to find the right place
to put it, in any case nothing changes. When I tried Patrick's
suggestion it worked, however it stripped the group name out of *every*
link, not only the main group.


2) Second, we need to make sure that if a link without group name is
clicked on it will automatically go to the right page in the main group.
I will not be able to come up with the right mod_rewrite syntax.
However, I'm wondering if this would be necessary: Right now, in the
original version, it IS sufficient to write wikisite.com/HomePage to
automatically arrive in the main group. However, when I tried Patrick's
suggestion, the links just wouldn't work (not even the links to the main
group, which confuses me).


So, would it be possible for someone around here to solve these two
problems in such detail that a greenhorn like me would be able to
implement them?

Thanks!
Michael




Joachim Durchholz wrote on 27.10.2005 10:28:
> 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
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>

-- 
michael at widowitz.com


-- 
michael at widowitz.com





More information about the pmwiki-users mailing list