Added redirect flag to the rewrite middleware.