I've found information on how to redirect one particular URL, but what I'd like to do is this kind of thing: have *any* request of the form
http://my.server.com/x/a/b/...
get redirected to
http://my.server.com/x/newPiece/a/b/c
where the path that comes after "x/" in the original URL (if anything) is preserved at the end of the "new" URL. In other words, I'm mapping an entire tree of my site to a new location.
Put a Script named b in my.server.com/x/a/ and use traverse_subpath to build your redirection URL. Pseudo code of script b:
redirect = http://my.server.com/x/newPiece/a/b/c/
for element in traverse_subpath: redirect = redirect + "/" + element
REQUEST.RESPONSE.redirect(redirect)
Tomorrow I think I'll be adding this functionality to MovedObject. It redirects and gives the proper HTTP status code, so as to inform search engines and whatnot. The current release doesn't do subpaths, but the next one will. There's also Rewriter and Redirector, but I never did figure out how they work, which is why I wrote MovedObject. Yes, it really was easier to write a new product than figure out the existing ones, at least in this case. --jcc -- "Code generators follow the 80/20 rule. They solve most of the problems, but not all of the problems. There are always features and edge cases that will need hand-coding. Even if code generation could build 100 percent of the application, there will still be an endless supply of boring meetings about feature design." (http://www.devx.com/java/editorial/15511)