rewrite, supports remote resources now