fix redirect to local and remote