Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.
(Answer) (Category) Java Apache Project : (Category) Apache JServ 1.0 : (Category) Configuration :
mod_rewrite doesn't seem to be able to change my mod_jserv URL's
The trick is getting mod_rewrite to execute before mod_jserv. This needs to be done at Apache compile time by having the mod_rewrite module compiled into Apache after the mod_jserv module.

If you are using the DSO version of Apache, try changing the LoadModule order. If that does not work, then you will probably have to compile a static version of Apache in order to get it to work properly.

If the above does not work, try reversing the order of the compiling/loading and append to this FAQ which order worked for you.

----------
From: tom.howland@us.pwcglobal.com
To: Java Apache Users java-apache-users@list.working-dogs.com
Subject: RE: mod_rewrite and JServ
Date: Thu, Mar 11, 1999, 7:20 PM


There is an evaluation order in apache such that, if you want to use
mod_rewrite with mod_jserv, you must ensure that the reference to mod_jserv
is *before* the reference to mod_rewrite. What this means is that in the
apache distribution, you have to modify the file
/usr/local/src/apache_1.3.4/src/Configuration so that the line

     AddModule modules/jserv/mod_jserv

appears before the line

     AddModule modules/standard/mod_rewrite.o

You have to get sure that mod_rewrite is excuted before mod_jserv. Have
alook in
'modules.c' and check that jserv is before rewrite_module. If not,
correct and recompile apache.

Jean-Luc Rochat
This is how I done it :
I compiled mod_jserv and mod_rewrite statically into apache. Then in the httpd.conf file you have to take care that the line
AddModule mod_jserv.c
comes before
AddModule mod_rewrite.c
it doesn't have to be done in the source dir as suggested above.

another hint: i found that while i could apply rewrite rules
in a virtual server, and could access servlets through a virtual
server, i couldn't do both together.  only the rewrite rules in
the main server part of httpd.conf seem to fire servlets.

example:

(in httpd.conf:)
# every page access under /foo/ fires AServlet, with the path part of the
# URL available via request.getQueryString()
RewriteRule ^(/foo/.*) "/servlets/EDU.wisc.soils.package.AServlet?$1" [PT]

(in servlets.properties:)
servlet.EDU.wisc.soils.package.AServlet.initArgs=siteRoot=/apachedir/htdocs

(in the servlet code:)
docRoot = new File(config.getInitParameter("siteRoot"));

etc., etc.
[Append to This Answer]
Previous: (Answer) How do I make hits on 'http://www.myserver.com/' go to a servlet? or Aliasing / to a servlet
Next: (Answer) Can you show me an example *working* configuration?
This document is: http://java.apache.org/faq/?file=47
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.709.
Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.