Is there a way to define rewrite rules in OCPSoft rewrite independent of case instead of defining multiple rules, since any character could be lower or upper case?
cb.addRule(Join.path('/Test').to("/test.xhtml"));
cb.addRule(Join.path('/test').to("/test.xhtml"));
Something like:
boolean ignoreCase = true;
cb.addRule(Join.path('/Test', ignoreCase).to("/test.xhtml"));
Background:
Logging our 404 errors i encounter a lot of requests just with lower case URLs.
Yes! Absolutely.
The simplest way to do this is probably use a parameter with a regex
.matches()constraint:You could also use the
ResourceorFilesystemcondition with a custom transform to make this a more global rule:Then...
This of course assumes that your xhtml files all use a lowercase naming scheme.
You could create your own custom
.when()conditions to locate the most likely matches, then substitute the 'found / correct' value of{path}in the transposition, if you wanted to go even farther.