Enhance rewrite middleware.

Changes:
- Replacement pattern is applied to the whole URL string rather than just path that lets to rewrite, for example, protocol.

Enhancements:
- Ability to use variables in replacement patterns with standard Go's templating engine syntax (http://golang.org/pkg/text/template).
- Ability to alter replace template variables in response bodies.
just `if rw.redirect` can work?