I have a legacy website that has URL like mysite.com/aaa/bbb and new one that is mysite.com/aaa . I want all users that go to mysite.com/aaa/bbb to go to mysite.com/aaa instead - what's the best and easiest way to do it? I only have one .war file that I can modify.
Does WebLogic have something similar to mod_rewrite (on Apache)?
Ok, one way to handle it could be do something like this in web.xml:
<servlet-mapping>
<servlet-name>Old portal</servlet-name>
<url-pattern>/bbb</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Old Portal</servlet-name>
<jsp-file>/index2.jsp</jsp-file>
</servlet>
and in index2.jsp forward to new website.
The other way (the one I actually taken) is to use URLRewriteFilter, I used this one:
http://www.tuckey.org/urlrewrite/
just added this:
<rule>
<from>^/bbb/*</from>
<to type="permanent-redirect">/aaa</to>
</rule>
to urlrewrite.xml config file (I also needed to include the jar with filter files) and it worked like a charm.