[pmwiki-users] CleanUrls, again (was: Putting ".html" extensions...)
Patrick R. Michaud
pmichaud at pobox.com
Fri Mar 3 19:43:06 CST 2006
On Fri, Mar 03, 2006 at 05:46:57PM -0700, H. Fox wrote:
> > > > # Send requests to pmwiki.php, appending the query string part.
> > > > RewriteRule ([^a-z].*) ~someuser/pmwiki/pmwiki.php?n=$1 [QSA,L]
> >
> > 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.
The caret is the difference, anchoring the pattern to the start
of the url path.
> 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
Oh yes, the difference is in handling urls pointing to directories.
For a url such as http://example.com/~someuser that points to
a directory, Apache issues a redirect asking the browser to
re-request the directory with the trailing slash appended.
But with the RewriteRule as listed above, we're overriding
that and sending it to the wrong place. So, the RewriteRule
you propose
> RewriteRule ^([^/a-z].*) ... [QSA,L]
>
> (with a / in front of a-z)
ought to be a reliable fix, and not due to sensitivity of some
particular webserver configuration.
Pm
More information about the pmwiki-users
mailing list