You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Carol Cheung <ca...@consumercontact.com> on 2009/02/11 18:23:48 UTC

trouble with url rewrite

I'm trying to user UrlRewrite for the following task:

If the user types http://localhost.whatever.com:8080/first/
I want the url redirected to
http://localhost.whatever.com:8080/second/here/user/index.jsp,
but the url that the user sees is still
http://localhost.whatever.com:8080/first/

When I go to http://localhost.whatever.com:8080/first/, I get a 404 error.

Can anyone shed some light on what I am doing wrong?

I'm using Tomcat 5.5

I have the urlrewrite jar in lib

Here's a portion of web.xml:
  <filter>
    <filter-name>UrlRewriteFilter</filter-name>
   
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
    <init-param>
      <param-name>logLevel</param-name>
      <param-value>WARN</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>UrlRewriteFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

And here's urlrewrite.xml
<urlrewrite>
    <rule>
        <from>/first/$</from>
        <to>/second/here/user/index.jsp</to>
    </rule>
</urlrewrite>

Thanks in advance,
Carol
-- 
View this message in context: http://www.nabble.com/trouble-with-url-rewrite-tp21958274p21958274.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] trouble with url rewrite

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Carol,

On 2/11/2009 12:23 PM, Carol Cheung wrote:
> I'm trying to user UrlRewrite for the following task:

Note that this is technically off-topic. UrlRewrite is often recommended
by users of this list, but nor supported by them. That's what the author
is for.

> If the user types http://localhost.whatever.com:8080/first/
> I want the url redirected to
> http://localhost.whatever.com:8080/second/here/user/index.jsp,
> but the url that the user sees is still
> http://localhost.whatever.com:8080/first/

Sounds like you aren't redirecting.

> <urlrewrite>
>     <rule>
>         <from>/first/$</from>
>         <to>/second/here/user/index.jsp</to>
>     </rule>
> </urlrewrite>

http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html

Maybe <to type="redirect">?

> When I go to http://localhost.whatever.com:8080/first/, I get a 404 error.

I suspect the page you're sending your users to have some sort of
problem. Once you have redirection working, you'll have to figure out
why your other page doesn't work.

If /first is the context path of your web app, then forwarding to
/second isn't going to work unless cross-context is enabled for your
context. What is your application's context path? Is /second in another
context? If so, perhaps the redirect will fix everything.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmTTAgACgkQ9CaO5/Lv0PA9rgCfQnwfBacC4D6NpmPeS/lF4Jl9
ZrsAnRAOw47P4GYexy/rbZxx1Ma7p9cg
=DyEl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org