Re: how to stop processing other rules if one is found

Splash Forums Rewrite Users how to stop processing other rules if one is found Re: how to stop processing other rules if one is found

#22281

Hey there,

I just did a quick test for this usecase. I think the problem is that the forwarded request of the first rule also matches the second rule. IMHO you can fix this by adding a DispatchType.isRequest() condition to both rules (especially the second one which matches the forwarded request).

Something like this

return ConfigurationBuilder.begin()
.defineRule()
.when(Direction.isInbound().and(DispatchType.isRequest()).and(Path.matches("/sitemap.xml")))
.perform(Forward.to("/fi/sitemap"))
.defineRule()
.when(Direction.isInbound().and(DispatchType.isRequest()).and(Path.matches("{path}").where("path").matches(".*")))
.perform(Redirect.permanent("/fi{path}"));

Does this work for you?

Christian