Hiya,

Something like this might do the trick:

<from>^/faq/[a-zA-Z0-9]*/(.*)\?.*locale=([a-zA-Z0-9]*)&amp;?+.*?$</from>

<to>/faq/$2/$1</to>
(note that the "&" needs to be escaped to "&amp;" in the urlrewrite filter
config), I think the container will append the request params when
performing the forward.

That should work for any amount of subdirectories and and requested page,
and it also shouldn't matter at which point the locale parameter appears in
the URL.

The only problem is that I think you might get stuck in an infinite loop as
the forward will be reprocessed by the filter... you could always tack
another request param on the end to indicate it's been processed I guess,
using a filter condition like:

<condition type="parameter" name="processed" operator="notequal"/>

and changing the to:

<to>/faq/$2/$1?processed=true</to>

which will check for the existence of a parameter called processed and only
apply the rule if the param isn't there... I guess that's a bit yucky, but
it's the best answer I can give with what I know so far.

I use this page to test reg exps, it's pretty handy:
http://www.fileformat.info/tool/regex.htm

Hope this is some help to you!

Cheers,

Pete


On 10/18/07, ros <[EMAIL PROTECTED]> wrote:
>
>
> Hi!
>
> What regular expression can be used to rewrite this URLs:
>
> from  /faq/LANG1/index.html?locale=LANG2   to
> /faq/LANG2/index.html?locale=LANG2
>
> from  /faq/LANG1/foo/index.html?locale=LANG2   to
> /faq/LANG2/foo/index.html?locale=LANG2
>
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/urlrewrite-tf4646656s2369.html#a13273518
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to