Parameter that matches over slashes

Splash Forums Rewrite Users Parameter that matches over slashes

This topic contains 3 replies, has 3 voices, and was last updated by  Christian Kaltepoth 8 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #25449


    Hi there

    Is it possible to match a parameter over slashes?

    I want to do this:



    MUST be a redirect.

    config.addRule().when( Direction.isInbound().and( Path.matches(“/{whatever}.xml”) ) ).perform( Redirect.temporary( “/{whatever}.html” )

    this works for all:

    but not
    if there is a “/” in the path it’s not matching anymore.

    Any solutions?


    Sure, just configure the parameter like this:

    .when( Direction.isInbound().and( Path.matches("/{whatever}.xml") ) )
    .perform( Redirect.temporary( "/{whatever}.html" )


    i want to do the same but without extension :


    Can i do that?


    Do you want to redirect or do you want to use a join? For a join it would look like this:

    .addRule( Join.path("/{whatever}").to("{whatever}.xhtml") )

    However, you have to be very careful with such rules, because they will also match CSS resources and images which typically means that your site will break.

    My recommendation is to either use a number of specific joins to capture individual pages like this:

    .addRule( Join.path("/login").to("/faces/login.xhtml") )

    Or fine tune your regular expressions so that images and CSS files do not match. You could for example do this by excluding . from the allowed characters.

    .addRule( Join.path("/{something}").to("/{something}.xhtml") )

    This would for example match /login and /some/where but NOT /styles/default.css.

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘Rewrite Users’ is closed to new topics and replies.

Comments are closed.