On Tue, May 26, 2015 at 12:12 PM, Frank Lehmann <frank-lehm...@freenet.de>
wrote:

> Hi Dan,
>

First, please don't top post.  Reply inline like this or at the bottom.


>
> you are right, i have used this documentation for setting the rewrite rule.
>
> This doc has is mistake in placing the rewrite.config file, but i solved
> it.
>

Second, what is the mistake you're referring to?


> My problem is, that the test condition never works.


> Every test rule is ignored.
>
> So what is the reason why every test condition is ignored ?
>

Third, we don't know.  You still haven't provided any configuration or
explanation of what you did.  Where did you configure the valve?  In
server.xml?  In the Context for an app?  Where did you put the
rewrite.config file?

I did a quick test and it worked for me.

1.) I added this to the context for the examples app:  `<Valve
className="org.apache.catalina.valves.rewrite.RewriteValve" />`

2.) I added `webapps/examples/WEB-INF/rewrite.config` to the examples app.

3.) In that file, I put the following.

```
RewriteRule     ^/junk$     /does-not-exist   [R]
```

4.) I started Tomcat and sent  this request with curl.  `curl -vv
http://localhost:8080/examples/junk`.  The response was a 302 redirect to "
http://localhost:8080/examples/does-not-exist";.

Dan

Reply via email to