[pmwiki-users] case-insensitive Rewrite Rules [was: How use lowercase in Group Names]

Patrick R. Michaud pmichaud at pobox.com
Thu Sep 29 11:17:39 CDT 2005


On Thu, Sep 29, 2005 at 11:57:31AM -0400, Waylan Limberg wrote:
> The original discussion has taken a few different directions, so I'm
> breaking this part off to make it easier to follow and find later. 

Cool.

> For those who missed it, we are looking for rewrite rules that allow
> case-insensitive or lowercase URLs that point to page names (how
> PmWiki handles those lowercase requests is another matter dicussed
> elsewhere), but also allow through requests to other files on the
> server. Currently, all URLs with uppercase letters are passed to
> PmWiki and all lowercase requests are not.

A minor clarification to avoid possible confusion:  The rewrite 
rule in the current CleanUrls recipe actually passes PmWiki more than 
just URLs with uppercase letters -- *everything* gets passed to 
PmWiki except urls beginning with a lowercase ASCII letter:

    RewriteRule ^([^/a-z].*) pmwiki.php?n=$1 [QSA,L]

The distinction is somewhat important, because in non-English 
and utf-8 sites there are many urls that belong to PmWiki that 
do not begin with an uppercase letter (or at least not with characters
from the set [A-Z], which we often mistake for "uppercase").

> Your welcome. I just ran a test on that exactly as it appears above
> and got some interesting results (it was passing things through to
> PmWiki fine, but not properly returning existing files).  After
> playing with it I found that this seems to work fine:
> 
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^([^.]+)$ phwiki.php?n=$1 [QSA,L]

Hmmm, that looks a little suspicious to me.  Why the [^.] there,
and the trailing $?  I would've expected 

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+) phwiki.php?n=$1 [QSA,L]

Pm




More information about the pmwiki-users mailing list