url rewrite doesn't work inside a querystring conditional?
Added by peacock over 11 years ago
I want to rewrite a pattern of URLs UNLESS a query string parameter is set. I want to use rewrite instead of redirect so that the URL stays the same in the address bar and the user can easily add the URL parameter to bypass the rewrite.
I see in http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite that rewriting does not work inside a $HTTP["url"] conditional. Should it work inside a $HTTP["querystring"] conditional?
I can't get the rewrite to work within a querystring conditional, but it DOES work within a $HTTP["host"] conditional. So not sure what's up. URL redirect does work inside the querystring conditional, but I want to use rewrite.
If rewriting doesn't work within a querystring conditional, is there a better way to do this?
Working code (rewrite happens regardless of whether querystring parameter is set):
url.rewrite-once = ( "^/tests" => "/denied.html" )
Non-working code (rewrite doesn't work at all):
$HTTP["querystring"] != "bypass" {
url.rewrite-once = ( "^/tests" => "/denied.html" )
}
Replies (3)
RE: url rewrite doesn't work inside a querystring conditional? - Added by stbuehler over 11 years ago
Hm right, it has the same problem as $HTTP["url"]
, although I see no reason for it. And maybe we should fix $HTTP["url"]
too...
RE: url rewrite doesn't work inside a querystring conditional? - Added by stbuehler over 11 years ago
Filed a bug for it: #2526
RE: url rewrite doesn't work inside a querystring conditional? - Added by gavenkoa about 11 years ago
#2526 was fixed starting from v1.4.34!