One thing I did found out is that in order for the PT to work, I have to use
the <servlet-mapping> tag in web.xml for every alias that needs a redirect.

Eg.
RewriteRule ^/hello(.*) /examples/servlet/HelloWorldExample$1 [PT]
(though I could use /servlet/HelloWorldExample instead)

Then add the following to my web.xml:
<servlet>
  <servlet-name>hello</servlet-name>
  <servlet-class>HelloWorldExample</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>hello</servlet-name>
  <url-pattern>/hello</url-pattern>
</servlet-mapping>

This will work for all my previous Rewriterules (from jserv setup).

In short, no change to rewrite rules but add every other alias name (hello)
used in the rewrite rule to the web.xml file!

Thanks for helping me found this.

-keng wong

> -----Original Message-----
> From: Keng Wong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 28, 2001 11:08 AM
> To: [EMAIL PROTECTED]; Jason Koeninger
> Subject: RE: apache mod_rewrite, mod_jk
>
>
> Jason,
> Thanks a lot. It works when the PT is changed to R (redirect).
> However, this
> will break existing paths currently used (jserv). Looks like this is
> documented in the HOWTO as well. Will this be fixed in 3.3x or
> Apache 2.x ?
>
> -keng wong
>
> > -----Original Message-----
> > From: Jason Koeninger [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 28, 2001 10:12 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: apache mod_rewrite, mod_jk
> >
> >
> > Yes, but the logs below and the error message you get
> > are showing Tomcat seeing /hello.  That shouldn't be
> > happening with what appears to be a good configuration.
> > Something else is going on here.
> >
> > Try switching from a pass-through rewrite to a redirect
> > rewrite and see if that works.  If it does, then it probably
> > means the interaction betweem mod_jk and mod_rewrite
> > doesn't work as expected.
> >
> > Best Regards,
> >
> > Jason Koeninger
> > J&J Computer Consulting
> > http://www.jjcc.com
> >
> >
> >
> > On Thu, 28 Jun 2001 09:09:01 -0700, Keng Wong wrote:
> >
> > >Jason,
> > >
> > >The JkMount directives are:
> > >JkMount /examples/servlet/* ajp13
> > >JkMount /examples/*.jsp ajp13
> > >
> > >I believe only these are passed to the servlet engine and not
> the entire
> > >site. Thanks for your response.
> > >
> > >-keng wong
> > >
> > >> -----Original Message-----
> > >> From: Jason Koeninger [mailto:[EMAIL PROTECTED]]
> > >> Sent: Thursday, June 28, 2001 8:06 AM
> > >> To: [EMAIL PROTECTED]
> > >> Subject: Re: apache mod_rewrite, mod_jk
> > >>
> > >>
> > >> What do your JkMount directives look like?  If you've done
> > >> something like:
> > >>
> > >> JkMount /examples/* ajp13
> > >>
> > >> I would think this would work fine (assuming the rewrite rule
> > >> is done correctly...I'm no expert), but if you did something like:
> > >>
> > >> JkMount /hello ajp13
> > >>
> > >> I can see where there would be problems.  You, of course, don't
> > >> want to mount the url you're trying to rewrite
> > >>
> > >> If you're doing something like:
> > >>
> > >> JkMount /* ajp13
> > >>
> > >> Then, I think you should back off and only mount the servlets until
> > >> you get your rewrite rule done correctly.  I also don't know the
> > >> interaction of mod_jk and mod_rewrite if they have competing
> > >> entries so that may cause you some more trouble if you're
> > >> pushing the whole site through to Tomcat.
> > >>
> > >> Hope that helps.
> > >>
> > >> Best Regards,
> > >>
> > >> Jason Koeninger
> > >> J&J Computer Consulting
> > >> http://www.jjcc.com
> > >>
> > >>
> > >> On Wed, 27 Jun 2001 23:08:23 -0700, William Wong wrote:
> > >>
> > >> >Hi,
> > >> >I had tried to setup mod_rewrite with mod_jk (ajp12 & ajp13)
> > but with no
> > >> >luck whatsoever. Even tried the approach mentioned in some of
> > >> the postings
> > >> >(dated Feb 2001) but without success.
> > >> >
> > >> >The setup:
> > >> >jdk1.3 (Sun)
> > >> >RH7.1
> > >> >apache-1.3.20 (DSO)
> > >> >tomcat-3.2.2 (downloaded from jakarta.apache.org)
> > >> >mod_jk.so (eapi) - downloaded from jakarta.apache.org
> > >> >
> > >> >httpd.conf:
> > >> >LoadModule jk_module libexec/mod_jk.so
> > >> >AddModule mod_jk.c
> > >> >
> > >> >LoadModule rewrite_module libexec/mod_rewrite.so
> > >> >AddModule mod_rewrite.c
> > >> >
> > >> >LoadModule ssl_module libexec/libssl.so
> > >> >AddModule mod_ssl.c
> > >> >
> > >> ><IfModule mod_rewrite.c>
> > >> >  RewriteEngine on
> > >> >  RewriteRule ^/hello(.*) /examples/servlet/HelloWorldExample$1 [PT]
> > >> ></IfModule>
> > >> >
> > >> >Include "/install/jakarta-tomcat-3.2.2/conf/mod_jk.conf"
> > >> >
> > >> >---[END OF httpd.conf]--------
> > >> >
> > >> >The mod_jk.conf is copied from the mod_jk.conf-auto but the
> > LoadModule is
> > >> >remarked.
> > >> >
> > >> >The following link works:
> > >> >http://localhost/examples/servlet/HelloWorldExample
> > >> >
> > >> >The following does not:
> > >> >http://localhost/hello
> > >> >The error on the screen:
> > >> >Not Found(404)
> > >> >Original request:/hello
> > >> >Not found request:/hello
> > >> >
> > >> >Tomcat log (mod_jk.log) shows:
> > >> >YYYY-MM-DD 00:00:00 - Ctx( ):404 R( + /hello + null) null
> > >> >
> > >> >Appreciate all the help I can get. Thanks for your time and
> attention.
> > >> >
> > >> >-keng wong
> > >> >
> > >>
> > >>
> > >
> >
> >
>

Reply via email to