Re: Basic Examples

Splash Forums Rewrite Users Basic Examples Re: Basic Examples

#22304

Hi There,

Yes, we really need to work on our documentation for Rewrite – it’s a very new project.

To do this, you can create a rule like so:

.defineRule().when(Path.matches("/html/{resource}")).perform(Forward.to("/{resource}"))

or you could do it the simpler way:

.addRule(Join.path("/html/{resource}").to("/{resource}"))

To answer your second question, you can do something like this:

.addRule(Join.path("/{file}.jsp").to("/{file}").where("file").matches(".*").withInboundCorrection())

And that should handle just about all the scenarios :), however, note that this is a VERY general rule, and you should be careful that you do not match more than you intended.

~Lincoln