On Wed, Jan 12, 2011 at 12:17 AM, James M <jmor...@gmail.com> wrote:
> <rule>
> <note>
> redirect
> </note>
> <from>/*</from>
> <to type="redirect">/abc</to>
> </rule>
> [...]
> Browsing to http://mydomain.com/new redirects to http://mydomain/abc/abc.
> Why does it double up on the path?
I had a look. I'm 99% sure it's a bug. Just a note, you're not
matching what you probably think you're matching here. Since this is a
regex you're matching the empty string or any succession of /-es. For
some reason, this triggers a bug somewhere. What does work is stuff
like:
<from>/.*</from>
or
<from>^/$</from>
or even:
<from>^/*$</from>
Which is Fred's workaround mentioned below, but the anchors shouldn't
really be making a difference.
> Also, how does one do a redirect to a different server if the to
> parameter is appended to the end of the original URL? The examples
> are really great, but they fail to demonstrate how to redirect to a
> different server or application context.
In principle it should work exactly like
HttpServletResponse.sendRedirect[1]. Note that you can also send a
permanent redirect (type="permanent-redirect"), which is usually the
more logical choice when sending cross-domain redirects.
> If anyone has any experience with this I'd love to see a working
> example of a full redirect and a redirect from a context path.
The from rules I listed above work for your example. They should also
work if you enter an absolute URL. I'm not sure what else you are
missing?
cheers,
Wim