How to map a web application to the root of a virtualhost?

Posted on

How to map a web application to the root of a virtualhost? – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, tomcat, mod-jk, , .

I wrote a MVC Servlet + JSP web application and deployed in Apache+Tomcat. I don’t call JSP directly, but I use them as view and I call them from the Servlets.

To make it visible in a virtual host, I mapped it using JkMount:

JkMount /MyApplication/* ajp13_worker

However now to access MyApplication I’ve to write URLs as

http://www.example.com/MyApplication/MyServlet

I would like to be able to call MyServlet from the root of my virtualhost such as in:

http://www.example.com/MyServlet

How do I do this?

How about:

RewriteEngine On
RewriteRule ^(/MyServlet.*) /MyApplication$1 [passthrough]

The passthrough will allow mod_jk to take the request after being processed by mod_rewrite

Leave a Reply

Your email address will not be published.