How to Redirect Users to Custom URL with Respect to Conditions?