Add auto redirect logic