Expected behavior in pattern matching with RewriteBase?

Topics: Developer Forum
Apr 30, 2010 at 4:43 PM

Ok, I was struggling with a simple match yesterday and I think I figured out what was going on.

Basically does RewriteBase strip the base off the URL *before* the pattern match?  My base is the root, therefore "/", and I was trying to match:


by using

RewriteRule ^/Shibboleth\.sso/ - [L]

and it wouldn't match.  After a *lot* of failed fixes, I found this to work as I desired:

RewriteRule ^Shibboleth\.sso/ - [L]

This lends support to the fact that the pattern being matched was "Shibboleth.sso/Metadata", not "/Shibboleth.sso/Metadata", i.e. the base was stripped before matching.

Is this expected?  The new docs seem to indicate that it is.  Is this consistent with RewriteBase in mod_rewrite for Apache (honestly my brain is so fried right now, I can't recall).

If so, the only change I'd request is the updated pattern is somehow displayed in the logs.  Most of my troubleshooting difficulty was due to the URL looking like it would match in the log, but failing, because it *wasn't* matching against the URL, but the URL minus the base.  Adding the exact pattern being matched against in the log would greatly simplify troubleshooting.

Apr 30, 2010 at 5:04 PM
Edited Apr 30, 2010 at 5:36 PM

I don't know the exact behavior of RewriteBase in Apache, but it would be very very good to be consistent with it.

I'll make available a modified build for you to test, shortly, if you don't mind.