I've put together a little demo decorating the ComponentEventLinkEncoder which I'm sure you could adapt to the deprecated URLRewriter if you prefer it that way. I've done it in tapestry 5.3 but it could be packported to tapestry 5.1.0.5 as is.
I've setup three "special" prefixes for "foo", "bar" and "facebook" If you download it and mvn jetty:run then hit http://localhost:8080/tapestry-sandbox/facebook/modepage1. You will see that the "mode" environmental is set to "facebook". Click on either of the links and you will be sent to http://localhost:8080/tapestry-sandbox/facebook/modepage2<http://localhost:8080/tapestry-sandbox/facebook/modepage1> Likewise, you can try http://localhost:8080/tapestry-sandbox/foo/modepage1<http://localhost:8080/tapestry-sandbox/facebook/modepage1> (mode = foo) Or http://localhost:8080/tapestry-sandbox/modepage1<http://localhost:8080/tapestry-sandbox/facebook/modepage1> (mode = null) Code is here https://github.com/uklance/tapestry-sandbox Interesting files here https://github.com/uklance/tapestry-sandbox/tree/master/src/main/java/com/github/uklance/extras Cheers, Lance.