PDA

View Full Version : 2 locations from the same application


Jaguar
15-02-2010, 08:58
Hi All,

I'm using tomcat 6 on Windows server.

I have an apllication, let's named it "app1".
One of the pages in the application is "loggin.jsp".
The full URL path for this page is:
"www.server.com/app1/package/app1/loggin.jsp"
I like that the following URL:
"www.server.com/package/app1/loggin.jsp"

to work also to first URL (I want that both will work, but I want a single instance of the application, just that if I access with the application name or without it will be to same page in the same application instance).

Is it possible?
Thanks in advance.
Shay

Kees de Kooter
15-02-2010, 09:29
If you are using apache in front of tomcat this can be easily achieved by configuring a url rewrite. See the docs for mod_rewrite (http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html).

Jaguar
15-02-2010, 14:18
I'm going to try it.

Jaguar
15-02-2010, 16:16
I chacked, and it's tomcat only.
Is it possible to do what I asked?

Thanks in advance
Shay

Kees de Kooter
15-02-2010, 23:47
URL Rewrite Filter (http://tuckey.org/urlrewrite/) claims to provide the same functionality. Maybe you should give that a try.

bakka
16-06-2010, 19:21
I think that you can use the virtualhost, you need to set your application as default by using :

Edit the conf/server.xml

</Host>
<!-- set webapp by default -->
<Host name="www.server.com" appBase="webapps">
<Context path="" docBase="PATH/TO/YOUR/APP/NAMED/app1"/>
</Host>

Example :
</Host>
<!-- set webapp by default -->
<Host name="www.server.com" appBase="webapps">
<Context path="" docBase="/home/tomcat/webapps/app1"/>
</Host>

in this way you don't need to put :
www.server.com/app1/package/app1/loggin.jsp
just type :
www.server.com/package/app1/loggin.jsp
and for me it's working only with :
www.server.com