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

H. Fox haganfox at users.sourceforge.net
Fri Mar 3 18:46:57 CST 2006


On 3/3/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Mar 03, 2006 at 04:51:58PM -0700, H. Fox wrote:
> > On 3/3/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > > 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.
>
> It does?  Oh, I think I made a typo -- it should probably be anchored:
>
>     RewriteRule ^([^a-z].*)   ~someuser/pmwiki/pmwiki.php?n=$1  [QSA,L]

That looks exactly the same to me.

Here's more detail: The 400 error doesn't happen always.

Bad request:
http://example.com/~someuser
Good request:
http://example.com/~someuser/
Good request
http://example.com/~someuser/Main/HomePage
Bad request:
http://example.com/~someuser?n=Main.HomePage&action=search&q=Test

This (from the old CleanUrls recipe) seems to work correctly... on my
system, anyway.

    RewriteRule ^([^/a-z].*)  ... [QSA,L]

(with a / in front of a-z)

Would that be likely to work in virtually any .htaccess file?  Might
this be sensitive to some server configuration setting?

Hagan




More information about the pmwiki-users mailing list