Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Serve JSP and PHP from the same WebRoot' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Serve JSP and PHP from the same WebRoot
Authored by: davipt on Sep 14, '05 11:13:17AM

Quick comment:

You can also use mod_rewrite and mod_proxy, instead of mod_jk, and use some crazy rules to redirect the traffic to the tomcat instance.

Something like this (not double checked):
RewriteEngine On

# Rewrite and proxy all .jsp requests to tomcat
RewriteRule ^(.*\.jsp) http://localhost:8080$1 [P,L]

# Rewrite all /admin/* requests to tomcat (isn't it called admin, the tomcat's web admin interface ?)
RewriteRule ^(/admin/.*) http://localhost:8080$1 [P,L]

# If the file corresponding to the requested URL exists in the tomcat webroot's directory, proxy the url to the tomcat instance
RewriteCond /opt/tomcat/webroot/%{REQUEST_FILENAME} -f
RewriteRule ^(.*) http://localhost:8080$1 [P,L]

# If the request ends in a '/' and there is a corresponding index.jsp in tomcat, proxy the request to it
RewriteCond /opt/tomcat/webroot/%{REQUEST_FILENAME}/index.jsp -f
RewriteRule ^(.*)/ http://localhost:8080$1/index.jsp [P,L]

There's so many nice things that can be done with mod_rewrite and mod_proxy.

[ Reply to This | # ]
Serve JSP and PHP from the same WebRoot
Authored by: deleted_user10 on Sep 15, '05 05:51:30PM

Will this "integration" be transparent to the user, so that the user never see the url with :8080? Is it protecting the WEB-INF as well?

[ Reply to This | # ]