Links to test the RewriteHandler
All examples below were configured using etc/jetty-rewrite.xml.
Internal URI rewrite
- Rewrite "../some/old/context" to "../rewritten/newcontext"
- This demo shows how the entire request URI can be internally rewritten to point to another context, using simple text matching
- Rewrite "../rewrite/for/beginning" to "../rewritten/beginning"
- This demo shows how the beginning of the request URI can be rewritten, while keeping the ending section
- Rewrite "bar/foo" to "foo/bar" using regex
- This demo shows how sections of the request URI can be rearranged. It uses regex to parse out each section, and then return them in reverse order
- Rewrite the beginning, and reverse the path sections
- This demo shows how rewrite patterns can be chained.
- Rewrite "bar/foo" to "foo/bar", full dump view
- This demo rewrites "bar/foo" to "foo/bar" the same as earlier, but shows a full dump of the request
Redirect
- Redirect "../redirect/this" to "../redirected/this"
- This demo redirects the request in a manner visible to the user agent, instead of doing an internal rewrite.
Cookie
- All pages
- This demo rule sets a "visited" cookie for each page you visit. The second time you go to any of the links above, you will see an additional line, "Previously visited: yes".
Response Code
- Return a 400 error status
- This demo shows how to modify the response code of a page to an error, based on its URL