Complete path rewriting in the rewrite function instead of partial so rewrites work for proxy as well as redirected URLs.