[pmwiki-users] CleanUrls, again (was: Putting ".html" extensions...)

H. Fox haganfox at users.sourceforge.net
Fri Mar 3 17:51:58 CST 2006

On 3/3/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> Here's my brief thoughts on the "lowercase" versus "file exists"
> discussion surrounding CleanUrls.
> Just to restate things:  the "lowercase" version says that Apache
> directly serves any url path beginning with a lowercase letter, and
> passes all others to PmWiki.  The "file exists" version says that
> Apache directly serves any url path that corresponds to an existing
> file, and passes all others to PmWiki.
> My comments:
>  -  I agree with Hagan that the topic is so complex (and there
>     are so many options) that the CleanUrls page should focus on a
>     single consistent approach, and not try to describe all of the
>     ways to do it.
> For the "file exists" approach:
[list of drawbacks]
> Given the limitations of the "file exists" approach above, I
> should note that my experience has been that admins are equally
> confused by the "lowercase" approach as well, especially when
> clean urls is being used to enable pages from the root.
> I don't have a strong hard-and-fast answer for which approach
> the clean urls page should use.  Because there's potential for
> difficulty with the "file exists" approach on case-insensitive
> filesystems, I think I'd tend towards using lowercase letters
> as the primary distinguishing method.
> But I also think it doesn't have to be an "either-or" situation --
> we can always do both.  Suppose we take the basic clean urls
> .htaccess structure as sending non-lowercase urls to PmWiki:
>     # Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
>     RewriteEngine On
>     # The rewrite base will be the document root.
>     RewriteBase /
>     # Send requests without parameters to pmwiki.php.
>     RewriteRule ^$           ~someuser/pmwiki/pmwiki.php  [L]
>     # Send requests for index.php to pmwiki.php.
>     RewriteRule ^index.php$  ~someuser/pmwiki/pmwiki.php  [L]
>     # Send requests to pmwiki.php, appending the query string part.
>     RewriteRule ([^a-z].*)   ~someuser/pmwiki/pmwiki.php?n=$1  [QSA,L]

I like that this is shorter, but I don't like that it results in

    Bad Request
    Your browser sent a request that this server could not understand.

> Then for those sites and admins that want to also directly serve
> files that begin with other characters, we add a subsection
> after example three that looks something like:
>     !!! Serving files and directories with uppercase letters
>     To allow url requests for files or directories that begin
>     with uppercase letters to continue to work, add the following
>     lines immediately before the last RewriteRule above:
>         RewriteCond %{REQUEST_FILENAME}  !-f
>         RewriteCond %{REQUEST_FILENAME}  !-d
> Is that workable?

Something like it.  Let me go back to the drawing board before
answering any further...


More information about the pmwiki-users mailing list