1

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)?

Musannif Zahir
  • 3,001
  • 1
  • 21
  • 31
Roman Goyenko
  • 6,965
  • 5
  • 48
  • 81
  • The war file contains what? The old webapp? The new one? Both? – JB Nizet Oct 24 '11 at 22:14
  • Nothing direct is available I think. Ideally there might be some DNS forwarding possible on your mysite.com if no web server is fronting your Weblogic. Try asking on serverfault.com – JoseK Oct 25 '11 at 12:30
  • I have one war that needs to handle 2 urls (or context roots). Old website would go to different URL, in this example it would be changed from mysite.com/aaa/bbb to mysite.com/aaa/bbb/old – Roman Goyenko Oct 27 '11 at 19:10

1 Answers1

2

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.

Roman Goyenko
  • 6,965
  • 5
  • 48
  • 81