Better solution for redirecting