Re: Move URL parameter position

Splash Forums PrettyFaces Users Move URL parameter position Re: Move URL parameter position


Hey @trivial2k,

You can use a global rewrite rule for something like this, notice you would need two rules, one rule if there are no incoming query parameters, and another rule if there are:

<rewrite match="/^(cutegirl)(/.*/.*.jsf)$" substitute="$2?username=$1" />

<rewrite match="/^(cutegirl)(/.*/.*.jsf?.*)$" substitute="$2&username=$1" />

Which should do what you want:$1)($2/*.*/*.jsf) ->*.*/*.jsf?username=cutegirl

I haven’t tested these specific rules, but they would look something like what I have written, using regular expressions:

This is equivalent to:

String newURL = ((String) request.getURI() + "?" + request.getQueryString()).replaceAll(match, substitute);

You can read more about regular expressions here: