On 05/02/2010, at 18:32, Ryan McIntosh wrote: > I'm trying to get a handler to match only PHP files in a web-directory. The > directory doesn't exist on the filesystem, and an alternate doc root is > specified in the config. > > I'm having issues using AND extension matching in combination with a web > directory rule. > > As a test, I tested the following configuration. I configured this in the > admin interface, but here's the relevent snippet. > > vserver!70!rule!500!match = and > vserver!70!rule!500!match!left = directory > vserver!70!rule!500!match!left!directory = /admin > vserver!70!rule!500!match!left!final = 1 > vserver!70!rule!500!match!right = not > vserver!70!rule!500!match!right!right = extensions > vserver!70!rule!500!match!right!right!extensions = png > > I would expect this to match all requests like ^/admin.* that don't have > filetype of png. > I would expect that '/admin/index.php' would be matched by this rule. It is > not.
Well, I've just made a test, and everything seems to be working fine. This is the configuration: vserver!10!rule!200!match = and vserver!10!rule!200!match!left = directory vserver!10!rule!200!match!left!directory = /admin vserver!10!rule!200!match!right = not vserver!10!rule!200!match!right!right = extensions vserver!10!rule!200!match!right!right!extensions = png vserver!10!rule!200!handler = custom_error vserver!10!rule!200!handler!error = 413 vserver!10!rule!100!match = default vserver!10!rule!100!handler = custom_error vserver!10!rule!100!handler!error = 410 And this is quick check: $ cget http://localhost:1234/admin/something.foo 2>&1 | grep Response Response : 413 Request Entity too large $ cget http://localhost:1234/admin/something.png 2>&1 | grep Response Response : 410 Gone Remember that the behavior rules are evaluated from top to bottom. If the rule does not match the evaluations goes on until another rule is matched or the default rule is matched. If I understood it right, you'd need a configuration file this: - Directory /admin: Sets Document Root, NON-FINAL - Directory /admin and (! Extension png): Handler=FastCGI, FINAL - Directory /admin: Handler=Static Content, FINAL or even better: - Directory /admin: Sets Document Root, NON-FINAL - Extension PHP: Handler=FastCGI, FINAL - Directory /admin: Static Content, FINAL -- Octality http://www.octality.com/ _______________________________________________ Cherokee mailing list [email protected] http://lists.octality.com/listinfo/cherokee
