[pmwiki-users] CleanURL
Patrick R. Michaud
pmichaud at pobox.com
Sun Apr 1 09:08:53 CDT 2007
On Sat, Mar 31, 2007 at 06:24:02PM -0400, DaveG wrote:
> On this page http://pmwiki.com/wiki/Cookbook/CleanUrls, the pattern
> ([^/a-z].*) is used throughout. Can someone describe what this is doing?
>
> The way I read it is to match anything not containing a forward-slash or
> letters a-z. But in the context in which it's used, my interpretation
> makes no sense. Somehow it should translate to match group/pagename, but
> it's not clear why.
>
> Not, the pattern does work, I just can't fathom why.
The pattern matches any path that doesn't begin with a letter "a-z"
or slash. It allows us to rewrite the following url
http://www.example.com/Group/PageName
while allowing other urls to fall-through to being handled by Apache
http://www.example.com/pub/skins/pmwiki/pmwiki.css
Without this sort of restriction, _all_ urls would end up being
rewritten and passed to PmWiki, so the above avoids rewriting
paths that begin with lowercase ASCII letters.
Early versions of CleanUrls tried using [A-Z].* to match pagenames
beginning with uppercase letters. But that pattern misses the
non-ASCII uppercase letters, so the pattern was switched to instead
match everything except paths beginning with a-z or / .
Petko's solution of matching [A-Z0-9\x80-\xff] is another valid
approach that has roughly the same effect.
Hope this helps,
Pm
More information about the pmwiki-users
mailing list